using System; using System.Diagnostics; namespace Next { class MainClass { public static void Main(string[] args) // this is a method called "Main". It is called when the program starts. { Random numberGenerator = new Random(); int num01 = numberGenerator.Next(1, 21); int num02 = numberGenerator.Next(1, 21); int num001 = 1; int num002 = 2; int num003 = 3; int num004 = 4; int num005 = 5; Console.WriteLine(" Welcome to XMATH!"); Console.WriteLine("------------------------------------------------------------------------------------------------------------------------"); Console.WriteLine(" Difficulty Selection \n1 \n2 \n3 \n4 \n5 \n6 \n7 \n8 \n9"); Console.WriteLine("To START the first level press 1 \nTo ENTER a code press 2\nTo EXIT the game press 3 \nTo see the RANKLIST press 4 \nTo see the CREDITS press 5"); Console.WriteLine(); Console.WriteLine("------------------------------------------------------------------------------------------------------------------------"); int answer01 = Convert.ToInt32(Console.ReadLine()); if (num001 == answer01) { Console.WriteLine(); Console.WriteLine("------------------------------------------------------------------------------------------------------------------------"); Console.WriteLine(); Console.Write("What is " + num01 + " plus " + num02 + "?: "); int answer = Convert.ToInt32(Console.ReadLine()); if (answer == num01 + num02) { Console.WriteLine("Well done! Your answer is correct."); } else { Console.WriteLine("Are you even trying?"); } } int answer02 = Convert.ToInt32(Console.ReadLine()); else if (num002 == answer02) { Console.WriteLine("------------------------------------------------------------------------------------------------------------------------"); Console.WriteLine(" Still in progress. \n Please wait for updates"); Console.WriteLine("------------------------------------------------------------------------------------------------------------------------"); } Console.ReadKey(); Console.WriteLine(); } } }
if (){ } // you cannot put code here. else if () { }
else if
answer02
if
int answer02 = ...
else
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)