int choice;
float x, y, result;
do//ทำ
{
Console.WriteLine("Please choose the choice that you want");
Console.WriteLine("1.add");
Console.WriteLine("2.erase");
Console.WriteLine("3.multiply");
Console.WriteLine("4.divide");
Console.WriteLine("5.exit");
choice = int.Parse(Console.ReadLine());
switch (choice)
{
case 1:
Console.Write("Please input a value x:");
x = float.Parse(Console.ReadLine());
Console.Write("Please input a value y:");
y = float.Parse(Console.ReadLine());
result = x + y;
Console.WriteLine("The result is {0}", result);
break;
case 2:
Console.Write("Please input a value x:");
x = float.Parse(Console.ReadLine());
Console.Write("Please input a value y:");
y = float.Parse(Console.ReadLine());
result = x - y;
Console.WriteLine("The result is {0}", result);
break;
case 3:
Console.Write("Please input a value x:");
x = float.Parse(Console.ReadLine());
Console.Write("Please input a value y:");
y = float.Parse(Console.ReadLine());
result = x * y;
Console.WriteLine("The result is {0}", result);
break;
case 4:
Console.Write("Please input a value x:");
x = float.Parse(Console.ReadLine());
Console.Write("Please input a value y:");
y = float.Parse(Console.ReadLine());
result = x / y;
Console.WriteLine("The result is {0}", result);
break;
case 5:
Console.WriteLine("exit");
Console.WriteLine("thank you");
break;
}
} while (choice != 5);
Console.ReadLine();