> But after fixing that, I got some new error! :(
Try this:
/*
somefun.cpp
Ian M Wilks
*/
#include
void main()
{
char yesOrNo;
int year = 1997;
int birth_year;
int ageThisYear;
cout << "\nThis program illustrates the use of variables.\n";
cout << "Please enter your year of birth: ";
cin >> birth_year;
cout << "Is the year still " << year << ". (Y/N): ";
cin >> yesOrNo;
if ((yesOrNo == 'N') || (yesOrNo == 'n'))
{
cout << "Please enter current year (1997): ";
cin >> year;
}
ageThisYear = year - birth_year;
cout << "You are " << ageThisYear << " this year.\n";
cout << "You are obviously ";
if (ageThisYear < 13)
cout << "a young person.";
else
if ((ageThisYear >= 13) && (ageThisYear < 20))
cout << "a teenager.";
else
if ((ageThisYear >= 20) && (ageThisYear < 40))
cout << "a person waiting for life to begin!!";
else
// if ((ageThisYear == 40)
// else
if ((ageThisYear > 40) && (ageThisYear < 60))
cout << "a person who wonders if work is worth it!!";
else
cout << "a person in the prime of life.";
}
I've fixed som strange characters (probably because of you using wrong
character sets or some characters are converted wrong on the way to this
bbs). The source code above compile and run fine on my Linux system.
bgk
--- BBBS/L v3.33 How
---------------
* Origin: Errors HQ: Prog/Emul/Linux/Demos, +47-56341083 (2:211/16)
|