-2
我是新來的編碼,我試圖從一些問題開始討論。它一直很好,直到我到底,它給了我一些關於無效令牌的錯誤。請閱讀這些行,並告訴我什麼是錯許多無效的令牌錯誤C#
using System;
namespace CheckIfOver18
{
class MainClass
{
public static void Main(string[] args)
{
Start:
Console.WriteLine("How old are you? \n");
int age = Convert.ToInt32(Console.ReadLine());
int yes = y;
if (age < 18)
{
Console.WriteLine("This game contains dismemberment and violence between victional characters, please get your parents or guardians to answer the next question.");
}
Console.WriteLine("\n This game contains dismemberment and violence between victional characters, do you allow your child to play this game? Please type y for yes or n for no");
Console.ReadKey(yes);
Console.WriteLine("Thank you for letting your child play this game, <press any key to continue");
Console.ReadKey();
}
else Console.WriteLine ("Sorry your child is not able to play this game");
goto Start;
if (age > 18){
Console.WriteLine("<Press any key to continue");
Console.ReadKey();
}
}
}
林新,所以如果你能告訴我該怎麼做直接的話,這將是很好的
你是什麼意思'int yes = y;'? y是什麼?你也確定你真的想使用'goto'嗎? – meJustAndrew
我試圖讓他們鍵入y是或n沒有 – Chody
在C#中沒有鍵入y, – meJustAndrew