Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num_to_guess;
- int user_guess;
- int score = 0;
- Random rnd = new Random();
- for (int i = 0; i < 10; i++)
- {
- Console.WriteLine("Round Num {0}", i + 1);
- int trial_counter = 0;
- num_to_guess = rnd.Next(1, 100);
- do
- {
- user_guess = int.Parse(Console.ReadLine());
- trial_counter++;
- if (user_guess < num_to_guess)
- {
- Console.WriteLine("Select bigger num");
- }
- else if (user_guess > num_to_guess)
- {
- Console.WriteLine("Select smaller num");
- }
- }
- while (user_guess != num_to_guess && trial_counter < 5);
- if (user_guess == num_to_guess)
- {
- Console.WriteLine("hooray, hooray - user guess the correcr number - {0}", num_to_guess);
- score += 10;
- Console.WriteLine("SCORE - {0}", score);
- }
- else
- {
- Console.WriteLine("you failed - the number is {0}", num_to_guess);
- }
- }
- Console.WriteLine("you SCORE is {0}", score);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement