I'm very much a begginer in C++ programming, and 2 days ago started following the tutorial. Did the examples and decided I was going to try making my own simple program. The Program is designed to figure out how many years apart your year of birth Is from my date of birth and output this data. The problem Is I don't know much yet about programming as I stated earlier.Code:#include<iostream> using namespace std; int main() { int year_of_birth; cout<<"Please enter the year you were born below, and It will tell you how much older or younger you are from me\n"; cin>> year_of_birth; cin.ignore(); if ( year_of_birth < 1980 ) { cout<<" You are older than me by"<<( year_of_birth - 1980 )<<"year(s)!\n"; } else ( year_of_birth > 1980 ) { cout<<" You are younger than me by"<<( 1980 / year_of_birth )"year(s)!\n"; } cin.get(); }
I was wondering If anyone could tell me what is wronge with it.
Also I'm aware there are some major problems with it just by looking at them, I just don't know what they are.
Thank You in Advance



LinkBack URL
About LinkBacks




beat u to it