Hey guys, so I've done all my programming in C++ up to this point and the syntax and logic surround IF ELSE statements seems to be a bit different. I'm learning the rules around C# now, and I can't seem to figure out why my little 20 line "pick a number" game isn't working. Maybe someone can clue me in? Here's the code.
Console.WriteLine("Let's play a game! I'm looking for a number 1-10");
int rightNumber = -100;
int points = 100;
while (rightNumber < 3 || rightNumber > 3)
{
rightNumber = int.Parse(Console.ReadLine());
if (rightNumber > 3)
Console.WriteLine("Too high!");
points = points - 1;
else
if (rightNumber < 3)
Console.WriteLine("Too Low!");
points = points - 1;
else
Console.WriteLine("You go it!");
}
Console.ReadLine();
Console.WriteLine("Your points equal " + points);
So basically, it's a loop that continues to loop until you select the correct number. If you get the wrong number, you are notified and then a point is subtracted from your score. I want each section of my IF ELSE statement to do two things: 1. Notify the player that they were too high/low/correct and 2: if they were too low or two high, a point is added to their score. In C++, IF a statement was true, you could have it generate multiple effects. For some reason, I'm having a hard time making that happen in C#. Can anyone clue me in?