Tuesday, July 14, 2009

C++ Help in Visual?

Here is my code it work in my other IDE BUT NOT IN VISUAL why THE PRECOMPILE HEADER IS TURN OFF. EVEN WITH TURN ON IT DIDN'T WORK

C++ Help in Visual?
Step 1) RELAX bro, in programming its bad to get fustrated, if you are take a break or something.





You forgot to use the line "using namespace std;" so either you need to use the namespace std, or you need to use the std class and the scope resoultion operator ( :: ) whenever you use cout...example





std::cout %26lt;%26lt; "This is how you use it";





#include %26lt;iostream%26gt;





using namespace std;





int main()


{


int a;


int my;


my = 15;





cout %26lt;%26lt; "What do u think My age is?: ";


cin %26gt;%26gt; a;





if(a == my)


{


cout %26lt;%26lt; "U have Guessed Right.. YEA!";


cout %26lt;%26lt; endl %26lt;%26lt; "Congradulation";


}


else


{


if(a %26lt; my)


{


cout %26lt;%26lt; "GO HIGHER" %26lt;%26lt; endl;


}


else


{


cout %26lt;%26lt; "TOO HIGH..Go LOWER" %26lt;%26lt; endl;


}


}


main();


return 0;


}
Reply:You need this:





#include %26lt;iostream%26gt;


using namespace std; // additional string.





It is very suspicious that your compiler does not catch such things: namespace is strongly required here.


No comments:

Post a Comment