KryptoKnight
In Runtime
- Messages
- 303
Ok.. I was making an age program, but came upon a problem... not too lifethreatening, but kind of weird. Here it is....
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int age;
cout<<"Please input your age: ";
cin>> age;
cin.ignore();
if ( age < 100 ) {
cout<<"You are pretty young... Let's all point and laugh!\n";
}
else if ( age == 100 ) {
cout<<"You are old... let's all point and laugh!\n";
}
else {
cout<<"You are really old, Sensei!\n";
}
cin.get();
}
I can enter the usual (99, 100 , 10, 1000,) but if I go any higher, like a trillion, it doesn't work and just shuts off on pressing enter
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int age;
cout<<"Please input your age: ";
cin>> age;
cin.ignore();
if ( age < 100 ) {
cout<<"You are pretty young... Let's all point and laugh!\n";
}
else if ( age == 100 ) {
cout<<"You are old... let's all point and laugh!\n";
}
else {
cout<<"You are really old, Sensei!\n";
}
cin.get();
}
I can enter the usual (99, 100 , 10, 1000,) but if I go any higher, like a trillion, it doesn't work and just shuts off on pressing enter