Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace _15.Instruction_Set
- {
- class InstructionSet
- {
- static void Main(string[] args)
- {
- string opCode = Console.ReadLine();
- while (opCode != "END")
- {
- string[] codeArgs = opCode.Split(' ');
- BigInteger result = 0;
- switch (codeArgs[0])
- {
- case "INC":
- {
- int operandOne = int.Parse(codeArgs[1]);
- result = ++operandOne;
- break;
- }
- case "DEC":
- {
- int operandOne = int.Parse(codeArgs[1]);
- result = --operandOne;
- break;
- }
- case "ADD":
- {
- int operandOne = int.Parse(codeArgs[1]);
- int operandTwo = int.Parse(codeArgs[2]);
- result = operandOne + operandTwo;
- break;
- }
- case "MLA":
- {
- int operandOne = int.Parse(codeArgs[1]);
- int operandTwo = int.Parse(codeArgs[2]);
- result = (BigInteger)(operandOne) * (BigInteger)(operandTwo);
- break;
- }
- }
- Console.WriteLine(result);
- opCode = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement