Advertisement
Felanpro

A weak return with dev c++

Feb 27th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. using namespace std;
  7.  
  8. int main(int argc, char** argv) {
  9.    
  10.     cout << "Hello my name is Felix and i'm the best" << endl;
  11.    
  12.     int rand_num = rand() % 20 + 1;
  13.     int user_guess;
  14.    
  15.     do
  16.     {
  17.     cout << "Guess number between 1 to 20: ";
  18.     cin >> user_guess;
  19.    
  20.     if(user_guess == rand_num)
  21.     {
  22.         cout << "you guessed it right!" << endl;
  23.     }
  24.    
  25.     }while(user_guess != rand_num);
  26.    
  27.     system("pause");
  28.    
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement