-4
Console.WriteLine("enter the sirial number of the followin bevrege you want to buy");
Console.WriteLine("beverge cost");
Console.WriteLine("1.ness cafe 2.25");
Console.WriteLine("2.black coffe 2.25");
Console.WriteLine("3.tea 1.30");
Console.WriteLine("4.hot choclate 2.50");
Console.WriteLine("5.soup 3.10");
Console.WriteLine("6.coca cola 3.30");
Console.WriteLine("7.orange juice 3.20");
int sirial;
sirial = int.Parse(Console.ReadLine());
double mouny, cost;
Console.WriteLine("enter how much ouny you enterd to the machine ");
mouny = double.Parse(Console.ReadLine());
if (sirial == 1 || sirial == 2)
cost = 2.25;
if (sirial == 3)
cost = 1.30;
if (sirial == 4)
cost = 2.50;
if (sirial == 5)
cost = 3.10;
if (sirial == 6)
cost = 3.30;
if (sirial == 7)
cost = 3.20;
if (mouny == cost)
Console.WriteLine(" n/ thank you for buying");
如果你輸入8會發生什麼?編譯器對此並不滿意。 – Steve
我現在他們告訴我們像編譯器只寫入類型數字從1到8 –
有什麼問題? –