Hi i am learning C++ i typed the following programm it is asking me to enter the age , when i enter age and hit eneter button it is generating the following message test2.exe has generated errore and will be closed by windows you will need to resterat the programm an error log is being created i did't underatsnd whats wrong with the programm i think it some thing relates to linking the programm can any one help me in this matter
i am doing this in windows 2000 using dev C++ compiler
#include #include
void main() { int age; cout<<"enter age\n"; cin>>"age"; if(age<=18) cout<<"child\n"; cin.get(); }
that should work.... although i would declare it has
int main()
{
int age = 0;
cout << "Please enter your age" << endl; //(endl creates new line)
cin >> age;
if ( age <=18)
cout << "Child";
else
cout << "Adult";
return 0;
}