iv been stuck with this program for a few days, my teacher doesn't really teach us code but expects us to now it so.
i have another version of this program without the text graphics and no help screen
the main problem for me is to do the if statements for when they press A or B
also im not sure if im doing the design in console.writeline right
so if u guys can tell me the problems and how to fix them
its also better if u looked at the attached file
i have another version of this program without the text graphics and no help screen
the main problem for me is to do the if statements for when they press A or B
also im not sure if im doing the design in console.writeline right
so if u guys can tell me the problems and how to fix them
its also better if u looked at the attached file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static void Main(string[] args)
{
string studentname, choice = "empty";
int Input = 0, number1, number2, answer, name;
Random ran = new Random();
for (int i = 1; i <= 10; i++)
Console.WriteLine("++++++++Welcome to Alans Maths game++++++++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ Please Enter you Name +++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ +++");
Console.WriteLine("++++++++++++++ MATHS +++++++++++++");
studentname = Console.ReadLine();
Console.Clear();
Console.WriteLine("++++++++Welcome to Alans Maths game++++++++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ A) Start B)/>/> Help +++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ +++");
Console.WriteLine( "Hello {0}!", studentname );
Console.WriteLine("+++ +++");
Console.WriteLine("++++++++++++++ MATHS +++++++++++++");
choice = Console.ReadLine();
Console.Clear();
if (choice == "b")
{
Console.WriteLine("++++++++ Welcome to Alans Maths game ++++++++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ HELP SCREEN +++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ 1. A question will be shown which you will answer +++");
Console.WriteLine("+++ 2. If incorrect you will have to retype the correct answer again +++");
Console.WriteLine("+++ 3. Once correct answer has been typed in you will be given another question+++");
Console.WriteLine("+++ 4. To exit press the x icon on the top right corner +++");
Console.WriteLine("+++ +++");
Console.WriteLine("+++ Press Enter to continue to the Game +++");
Console.WriteLine("+++ +++");
Console.WriteLine( "{0}!", studentname );
Console.WriteLine("+++ +++");
Console.WriteLine("++++++++++++++ MATHS +++++++++++++");
Console.ReadKey();
Console.Clear();
}
if (choice == "a")
} break;
}
}
{
number1 = ran.Next(0, 10);
number2 = ran.Next(0, 10);
answer = number1 * number2;
Console.Write("what is {0} times {1}?: ", number1, number2);
Input = int.Parse(Console.ReadLine());
int rand = ran.Next(1, 5);
while (Input != answer)
{
switch (rand)
{
case 1:
{
Console.WriteLine("No. Please try again");
} break;
case 2:
{
Console.WriteLine("Wrong. Try once more");
} break;
case 3:
{
Console.WriteLine("Dont give up!");
} break;
case 4:
{
Console.WriteLine("No Keep trying");
} break;
}
Console.Write("what is {0} times {1}?: ", number1, number2);
Input = int.Parse(Console.ReadLine());
rand = ran.Next(1, 5); // for a new number incase the answer is wrong
}
if (Input == answer)
{
switch (rand)
{
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;
}
}
}
}
}
}
}
}