ok everything works great on my compiler except for my cout, cin. when i try to compile my program it tells me i need to verify cout, and cin. this is my second day programming so please dont flame.
ok everything works great on my compiler except for my cout, cin. when i try to compile my program it tells me i need to verify cout, and cin. this is my second day programming so please dont flame.
Post your code in code tags, tell us which compiler you are using, and how you are compiling the code. Read the sticky posts at the top of the forum.
Code:# include (iostream) using namespace std; int main () // Most important part of the program! { int age; // need a variable... cout<< " please input your age: "; // asks for age cin>> age; // tHE INPUT IS PUT IN AGE cin.ignore(); // tHROW AWAY ENTER if ( age < 100){ // iF AGE OS ;ESS THAN 100 cout<< " you are pretty young!!\n"; //JUST TO SHOW IT WORKS } else if ( age == 100){ // USED JUST TO SHOW EXAMPLE cout<<"you are old\n"; // SHOWS IT WORKS } else { cout<<"you are really old\n"; // EXECUTES IF NO OTHER STATMENT IS } cin.get(); }
oops sorry for got to type. i am using bloodshed and my compiler tells me that all my cout and cin. need to be declared.
Last edited by bigd5; 05-31-2005 at 06:55 PM. Reason: mistake
Simple problem. It should be <iostream>, not (iostream).
Also, if that is the way your program is tabbed in your Dev-C++ IDE, then you should probably reformat it to make it cleaner. It will still compile, but that is really hard to read.
Maybe like this:Code:# include <iostream> using namespace std; int main () // Most important part of the program! { int age; // need a variable... cout<< " please input your age: "; // asks for age cin>> age; // tHE INPUT IS PUT IN AGE cin.ignore(); // tHROW AWAY ENTER if ( age < 100){ // iF AGE OS ;ESS THAN 100 cout<< " you are pretty young!!\n"; //JUST TO SHOW IT WORKS } else if ( age == 100){ // USED JUST TO SHOW EXAMPLE cout<<"you are old\n"; // SHOWS IT WORKS } else { cout<<"you are really old\n"; // EXECUTES IF NO OTHER STATMENT IS } cin.get(); }
what do you mean by reformat. Im new i just started yesterday. i see the mistake i made now thanks. but what do you mean by reformat. like make more spaces and stuff.
Like I showed in the code I added to my post. The braces are indented evenly and each block of code is properly indented. My version doesn't look as nice because of a bug in the forum software that turns four spaces into really big tabs, but you should get the idea. Compare my version with yours and see which one is easier to see where the if ends, where the main function ends, etc.