SHARE
TWEET

How old are you?

aod6060 May 6th, 2012 13 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.         How old are you? Are you an anchent or green? :D
  3. */
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.         int age;
  10.        
  11.         cout << "Please enter you're age: ";
  12.        
  13.         cin >> age;
  14.        
  15.         while(age < 0) {
  16.                 cout << "Invalid age, your age has to be greater than 0" << endl;
  17.                 cin >> age;
  18.         }
  19.        
  20.         if(age >= 21) {
  21.                 cout << "Well at least you old enough to dring so here's a beer!!!" << endl;
  22.         } else if(age < 21 && age >= 18) {
  23.                 cout << "Congrats, you can smoke ciggaretts or cigars, join the military, get married, and vote." << endl;
  24.         } else if(age < 18 && age >= 16) {
  25.                 cout << "Well, you can finally drive a car and get a part time job. So its time for you to pay rent." << endl;
  26.         } else {
  27.                 cout << "A youngen eh, well at least you can get away with pretty much anything." << endl;
  28.         }
  29.        
  30.         return 0;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top