Advertisement
idsystems

CPP_Practica68_GuessMyAge

Mar 15th, 2013
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. // Program: guess.cc
  2. // Author:  Yoan Pinzon
  3. // Date:    Agosto 30, 2006
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main(){
  10.    const int age=26;
  11.    int x, count=0;
  12.  
  13.    do{
  14.       cout << "Guess my age: "; cin >> x;
  15.       count++;
  16.       if( x > age ) cout << "Too high! ";
  17.       if( x < age ) cout << "Too low! ";
  18.    } while(x != age );
  19.    cout << endl << "Well done - that took you " << count << " tries." << endl;
  20.  
  21.    return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement