How to use user imput and make it have a correct or incorrect outcome with the data type string (so words not numbers)

  • Thread starter Thread starter CoolMuffin
  • Start date Start date
C

CoolMuffin

Guest
Please help me make this work

bool success = false;
do
{
Console.WriteLine("Welcome " + name + " to the Spelling Game");
Console.WriteLine("Enter 1 for Beginner");
Console.WriteLine("Enter 2 for Intermediate");
Console.WriteLine("Enter 3 for Advanced");
int result;
if (int.TryParse(Console.ReadLine(), out result))
{

if (result == 1)
{
Console.WriteLine("Welcome to Beginner, " + name);
Console.WriteLine("Enter the full word ");
Console.WriteLine(" The person that gave birth to you " + name + ", was your m_ _ _ _ _");
bool answer1 = false;
do { int motheranswer;
if (string(Console.ReadLine(), out motheranswer))
{ if (motheranswer("mother"))
{
Console.WriteLine("Corect" + " You will progress to the next level");
}
else
{ Console.WriteLine("Incorrect"); }
}
} while (answer1);
success = true;

This variable -'motheranswer' - comes up with a error message -

do { int motheranswer;

Also this one

{ if (motheranswer("mother"))

Also I have had to use the data type (if this is one)- 'while' instead of 'until'

Thanks

Continue reading...
 
Back
Top