Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6.     int Answer = rand() % 10 + 1;
  7.     int Guess = 0, Tries = 2;
  8.     std::cout << "I am thinking of a number from 1 to 10\nYou must guess what it is in three tries";
  9.  
  10.     while ( Guess != Answer )
  11.     {
  12.         std::cout << "\n" << Answer << "\nEnter your guess: ";
  13.         std::cin >> Guess;
  14.         if ( Guess == Answer )
  15.         {
  16.             std::cout << "CORRECT!";
  17.             std::getchar();
  18.         }
  19.         else if ( Guess != Answer && Tries == 0 )
  20.         {
  21.             std::cout << "You're a faggot.\nExiting...";
  22.             break;
  23.         }
  24.         else
  25.         {
  26.             std::cout << "Sorry, please guess again";
  27.             Tries -= 1;
  28.         }
  29.  
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement