/* Name: Birthdays Copyright: 2006 Author: CIS 1.5 Class Date: 07/05/06 10:38 Description: Write a C++ program....... Use the trailer method to signal the end of data */ #include #include using namespace std; int main(int argc, char *argv[]) { float birthMonth, birthYear, currentMonth, currentYear, age; cout.setf(ios::fixed,ios::floatfield); cout << "Please enter your birth month, birth year as well as" << endl; cout << "the current month followed by the current year." << endl; cout << "Enter four zeros to stop." << endl; cin >> birthMonth >> birthYear >> currentMonth >> currentYear; while (birthMonth > 0) { age = currentYear - birthYear + (currentMonth - birthMonth)/12; cout.precision(0); cout << "For " << birthMonth << " and " << birthYear << " your age is "; cout.precision(1); cout << age << endl; cout << "Please enter your birth month, birth year as well as" << endl; cout << "the current month followed by the current year." << endl; cout << "Enter four zeros to stop." << endl; cin >> birthMonth >> birthYear >> currentMonth >> currentYear; } // end of loop system("PAUSE"); return EXIT_SUCCESS; }