Skip to main content

Thread: C++ quick bit of help needed will take less than a minute i promise!


code:
#include <iostream>     using namespace std;     int main()  {      int age = ( 2011 - dob ); //its doing wrong?   int dob;      cout<<"please enter date of birth: ";   cin>> dob;   cin.ignore();      if ( age < 100 ){           cout<<"you young!\n";          }          else if ( age == 100 ) {                  cout<<"you old!\n";  }          else {                  cout<<"you old!\n";          }   cin.get();  }
not quite sure doing there following tutorials , trying change stuff go. need line 8

you using dob variable before declaring , initializing it.

moving line 8 after cin.ignore() solve problem.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk C++ quick bit of help needed will take less than a minute i promise!


Ubuntu

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support