before cin.get(); you must clear the '\n' that still remains in the
stream, how you clear it? with the cin.ignore();
here's the complete code:
Code:
#include <iostream.h>
using namespace std;
int main (int argc, char *argv)
{
int age;
cout << "please input your age:";
cin >> age;
if(age<100)
{
cout << "you are pretty young";
}
else if(age==100)
{
cout << "you are old";
}
else
{
cout << "you are really old";
}
cin.ignore();//clear the new line character
cin.get();//wait for input
//you can use : system("pause") too, but is not that portable
//and you dont need the cin.ignore if u use system("pause")
//dont forget to include the <stdlib>header when using,
//system("pause");
return 0;
}
please excuse my poor english