Question:
Something is wrong in C++, or am I doing something wrong?
2011-04-14 18:08:32 UTC
Recently, I have just started programming in C++. I have gotten a Dev-C++ compiler, but there's a problem. Whenever I type in the following code, it won't run. Although I know you have to compile it first, the thing is I can't. It always confronts me by saying that the first line isn't correct.
Here's the code:

include iostream.h

int main ()
{

cout<<"Welcome to C+";
return 0:
}

Thanks for helping. Leave me additional feedback if possible!
Four answers:
Jazka
2011-04-15 04:02:39 UTC
include



int main()

{



cout << "Welcome to C+" << endl;



system ("PAUSE");



return 0;

}



Try that. It should work. Alternatively, for the first line you could try #include. It's basically the same as #include.



Also, if you copied and pasted you have a colon after the return 0 instead of a semicolon.



Other than that, it should be okay. (Although, do you mean "C++" instead of "C+" in your cout statement?)
Ramandeep
2011-04-16 07:24:30 UTC
try using eclipse wascana as c++ ide for class 11 and 12

you can get it at



http://eclipselabs.org/p/wascana



and the correct form of above code is



#include

using namespace std;

int main ()

{

cout<<"Welcome to C+";

return 0:

}
Nath T
2011-04-14 18:18:26 UTC
Not only do you need to type iostream.h in quotes, but if you want your program to stay up so you can see the output, add getchar(); before it says return.
The Phlebob
2011-04-14 18:15:08 UTC
You need <---> angle brackets around the iostream.h in the #include directive.



Hope that helps.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...