I told you... either this way:
if((year>=0)&&(year>=9999))
{
//code
}
else
cout <<"GTFO!"endl;
or my other post ;)
here:
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
bool succ;
int intYear;
string strYear;
cout <<"Value for strYear:";
cin >> strYear;
if(strYear.length()<=4)
{
stringstream sti(strYear);
sti >> intYear; //this should be two lines lower but there's a problem with the if...nvm it works like this too
if(intYear==0)
{
cout<<"Wrong year input...use numbers!"<<endl;
succ=0;
}
else
{
cout<<"strYear is <= 4 digits, converting it to integer in variable intYear..."<<endl;
succ=1;
}
}
else
{
cout<<"Wrong year input.(must be < 9999)"<<endl;
succ=0;
}
if(succ==1)
{
//code
}
else
{
cout <<"exiting program..."<<endl;
}
return 0;
}