Sunday, 18 August 2013

Guessing a word within 3 tries. If failed in 3rd try, continue to next statement

Guessing a word within 3 tries. If failed in 3rd try, continue to next
statement

So I need a solution that will let me guess a word from the jumbled
letters. I must guess it within 3 tries. If I get it within the 3 tries, I
will get 500 points. For every wrong guess I will get 250 points
deduction. If I used up my 3 tries, the application will go on to the next
word.
NOTes:
Before the break command, it continue to write the line "Answer? "
After the break command, same results
score = 1000;
x = 0;
Console.WriteLine("WORD #1: ketbabasll");
Console.WriteLine("HINT: SPORTS");
do
{
Console.Write("Answer? ");
word = Console.ReadLine().ToLower();
}
while (word != "basketball");
if (word == "basketball")
{
score = score + 500;
}
else if (word != "basketball")
{
score = score - 250;
x = x + 1;
if (x == 3)
{
break;
}
}

No comments:

Post a Comment