I started my apprenticeship 1 month ago and from my company I got my first task to create a Calculator in the console which is capable to do basic math (addition, subtraction, multiplication and ofc divide). Now I made my code so far to enter 2 numbers but what next? What command do I have to use to choose the correct term of calculating?
In the End I just want to put in a + if I want to add etc.
Here is my Code. I use Visual Studio 2019 and C#.
using System;
namespace Taschenrechner
{
class Program
{
static void Main(string[] args)
{
int num1;
int num2;
Console.WriteLine("Taschenrechner");
Console.WriteLine("Gib die erste Zahl ein");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Gib die zweite Zahl ein");
num2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Gib die Rechenaufgabe an");
Console.WriteLine(num1 + num2);
Console.WriteLine(num1 - num2);
Console.WriteLine(num1 * num2);
Console.WriteLine(num1 / num2);
Console.ReadKey();
}
}
}