hi i have a problem in C program ..
i m new to C .. help me
#include %26lt;iostream%26gt;
int main() {
std::cout %26lt;%26lt; "help";
return 0;
}
what is the problem with this program
i m compiling it with turbo c++ compiler 3.0
and it gives me three errors
unable to open iostream file
std must b a class or struct
statement missing ..
tell me waht is the problem with this program .or this is the problem with compiler
Difficulty in C++ program?
Which turbo C++ is that? The ancient DOS version?
iostream.h
remember .h
cout%26lt;%26lt;
No std::
Reply:stdio
Reply:This link to Turbo C++ compiler 3.0 might help trouble-shoot that:
http://www.codepedia.com/1/TurboCppHello...
Good Luck.
Reply:this compiler is not full or you forgot to type file extension behind "iostream", try finding it and getting its extension
Reply:first it's "iostream.h"
I believe that you must first call the std lib
do this by putting "using namespace std;" after your include
Reply:Yeah you can either add the ".h" extension like everyone said, or you can leave that off and stick (on the next line) "using namespace std;" (without the quotes). Also you don't need the "std::". Just say "cout %26lt;%26lt; "help;"" By the way, I like to stick a "%26lt;%26lt; endl;" at the end of all my couts. It makes your program prettier (like hitting enter). So here's what it should look like:
Either,
#include %26lt;iostream.h%26gt;
int main()
{
cout %26lt;%26lt; "help" %26lt;%26lt; endl;
return 0;
}
OR
#include %26lt;iostream%26gt;
using namespace std;
int main() {
cout %26lt;%26lt; "help" %26lt;%26lt; endl;
return 0;
}
It really depends on the compiler. It may take either, or it may only take one of them.
Reply:Turbo C++ 3.0 for DOS is from 1991. That's sixteen *years* ago, long before C++ was even standardized as a language. Turbo C++ 3.0 predates Boris Yeltsin as Russian President. There's a whole lot of perfectly legal, standards compliant code that isn't going to work in that ancient monstrosity.
If you get a modern compiler, you'll find your problem has disappeared. For windows, consider MSVS 2k5 express or Borland C++ Builder; for unix, use whatever's already installed, probably GCC. (Given that you're using a DOS compiler, extensive unix conversation seems wasted.)
Free, standards compliant, and packaged with a first class debugger:
http://msdn.microsoft.com/vstudio/expres...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment