+ 1
Itâs not that hard at all,
you get user input of 2 numbers and which operator to do (+, -, /, *)
and then give them the result,
a simple example (C#)
public void main()
{
int x;
int y;
string op;
while(true)
{
Console.WriteLine(ânum: â)
x = int.parse(Console.ReadLine());
Console.WriteLine(ânum2: â)
y = int.Parse(Console.ReadLine());
Console.WriteLine(âoperator: â)
op = Console.ReadLine();
Console.WriteLine(calc(x, y, op);
}
}
private double calc(int x, int y, string op)
{
int res;
switch(op)
{
case â+â:
res = x + y;
break;
case â-â:
res = x - y;
break;
case â/â:
res = x / y;
break;
case â*â:
res = x * y;
break;
}
return res;
}
+ 1
In what language.