Tom Kelliher, CS17
Feb. 9, 1996
We will be going into the lab. Our goal is to accomplish the following things:
Enter, compile, and run the following program:
#include <iostream.h>
const int MAX_STRING = 30;
const int CURRENT_YEAR = 1996;
const long DELAY = 10000000;
int main()
{
char name[MAX_STRING];
int age;
int birthYear;
char response;
long delay;
cout << "Hi! I'm Felix." << endl;
cout << "What's your name? ";
cin.getline(name, MAX_STRING);
cout << "How old are you, " << name << "? ";
cin >> age;
if (age >= 19)
cout << "You're OLD!!" << endl;
birthYear = CURRENT_YEAR - age - 1;
cout << "Were you born in " << birthYear << "? (y or n) ";
cin >> response;
if (response == 'y')
cout << "I'm smart, aren't I?" << endl;
else
cout << "Your birthday is too early in the year!" << endl;
delay = DELAY;
while (delay > 0)
delay = delay - 1;
cout << endl << "Well, gotta go. See you next time!!"
<< endl << endl;
return 0;
}