hi everyone
I am doing a course on c#...started one week ago with absolutely no prior exp in this,getting frustrated with this calculator.
Can anyone tell me what is wrong and why,i don't want a quick fix,i want to learn(you get no cookie for bashing me on making a "simple" mistake)
Double no1 = 0, no2 = 0, Ans = 0;
String Choice;
Console.WriteLine("Wellcome to 'my' calculator...it definitely did not take me 2 hours of tutorials to figuer this out");
Console.WriteLine("Press <F1> then Enter to get started...Simon says!");
while (Console.ReadKey().Key != ConsoleKey.F1) { }
Console.ReadKey();
Console.Write("Please enter No1: ");
no1 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Please chose operation:(+,-,* or /)");
Choice = Console.ReadLine();
Console.Write("Please enter No2: ");
no2 = Convert.ToDouble(Console.ReadLine());
// comment here
if (Choice == "+")
{
Ans = no1 + no2;
}
if (Choice == "-")
{
Ans = no1 - no2;
}
if (Choice == "*")
{
Ans = no1 * no2;
}
if (Choice == "/")
{
if (no2 == 0)
{
Console.WriteLine("Ans= ERR");
}
else
{
Ans = no1 / no2;
}
Console.WriteLine("the operation has been apllied");
Console.Write("The Anwser is = " ,Ans);
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
Not sure if it matters but i am using ms visual studio 2015
thanks if anyone will actually help!