# Age Algorithm - GREAT for Beginners!

Email
 Submitted on: 1/3/2015 8:54:00 PM By: Brian Griffin (from psc cd) Level: Beginner User Rating: By 6 Users Compatibility: C, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++ Views: 1756

This is my first C++ algorithm as well as my first submission to PSCode. It is definitely great for beginners. It has basic I/O and practices doing math in C++. You enter your age, the current year, and a year in the future and it tells you how old you will be in that year.

 ``` /************************************* * Age Calculation Algorithm * * By: Brian Griffin* *************************************/ #include   //NOTE: the above line is supposed to say iostream.h inside <>'s following the include. It was interpreted as HTML so it disappeared. void main(){ int age, newYear, currentYear, newAge, next; cout << "Age Calculation Algorithm" << endl; cout << "By: Brian Griffin" << endl; cout << "--------------------------" << endl; cout << "Age: "; cin >> age; cout << "Current Year: "; cin >> currentYear; cout << "Year to find age in: "; cin >> newYear; cout << "--------------------------" << endl; newAge = (newYear - currentYear) + age; cout << "You will be " << newAge << " in the year " << newYear << "." << endl; cin >> next; } ```

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)