Thursday, July 9, 2009

C++ EXPERTS!! HELP!! Please??

I use:





#include %26lt;iostream.h%26gt;





main()


{


cout %26lt;%26lt; "Hello World!";


return 0;


}





In MS Visual C++ and always get the same error!!





1%26gt;c:\documents and settings\c j smith\my documents\visual studio 2005\projects\test\test\test.cpp(6) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory


1%26gt;Build log was saved at "file://c:\Documents and Settings\c j smith\My Documents\Visual Studio 2005\Projects\test\test\Debug\BuildLog.h...


1%26gt;test - 1 error(s), 0 warning(s)


========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========





And a pop up?





Unable to start program c:\documents and settings c j smith\my documents\visual studio 2005\projects\test\debug\test/exe.





The system cannot find the file specified.





PLEASE HELP!

C++ EXPERTS!! HELP!! Please??
It should be this:





#include %26lt;iostream%26gt;





using namespace std;





int main()


{


cout %26lt;%26lt; "Hello World!";


return 0;


}
Reply:The ".h" in "iostream.h" is archaic and should not be used. That line should read:





#include %26lt;iostream%26gt;





Also, you might want to give main() a type.... int main() and void main() are both acceptable.


No comments:

Post a Comment