這是我迄今爲止。我的問題是,當你輸入正確或不正確的答案時,沒有任何案件正在響應。我不確定該從哪裏出發。該程序會要求您回答兩個隨機數字相乘。然後它會給你八個答覆中的一個。c#切換問題。家庭作業
int result = 0;
int caseSwitch = 0;
string question = DoMultiplication(out result);
Console.WriteLine(question);
int answer = Convert.ToInt32(Console.ReadLine());
if (answer == result)
{
switch (caseSwitch)
{
case 1:
Console.WriteLine("Very Good");
break;
case 2:
Console.WriteLine("Excellent");
break;
case 3:
Console.WriteLine("Nice Work");
break;
case 4:
Console.WriteLine("Keep up the good work!");
break;
}
}
else
{
switch (caseSwitch)
{
case 1:
Console.WriteLine("No, Please Try Again.");
break;
case 2:
Console.WriteLine("Wrong, Try Once More");
break;
case 3:
Console.WriteLine("Don't Give Up!");
break;
case 4:
Console.WriteLine("No, Keep Trying!");
break;
caseSwitch始終爲0 – jfin3204
caseSwitch始終爲0,所以交換機永遠落空不寫任何東西來安慰 – geedubb
我會在哪裏看看看如何從4個案例中挑選出來?我發現將caseSwitch分配給1總是會給我回應。 –