Newbie C++
#include <windows.h>
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
{
cout << "Hello World!" << endl;
cout << "The size of an int is : \t\t"
<< sizeof(int) << " bytes.\n";
cout << "Press ENTER to continue..." << endl;
getchar ();
return 0;
}
it says: it misses an colon but i dont know where since i am an newbie
your code looks fine... could you post the exact error message(s)? (all of them, if there''s more than one.)
Also, what compiler are you using?
Don''t listen to me. I''ve had too much coffee.
Also, what compiler are you using?
Don''t listen to me. I''ve had too much coffee.
Post the exact error message you get (use copy and paste). "misses a colon" tells us nothing.
By the way, it compiles without any errors with Visual C++ 6.
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
By the way, it compiles without any errors with Visual C++ 6.
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Also, I corrected the following weirdness in your code:
* Uses \n and endl randomly
* Uses iostream.h instead of just iostream
* Uses unnecessary headers (which increase compile time)
* Uses both C and C++ stream IO (they may not be compatible so just use one or the other).
Edit - is there NO WAY to get your code to look the same inside a code or source tag?
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
[edited by - siaspete on September 8, 2002 5:10:16 AM]
* Uses \n and endl randomly
* Uses iostream.h instead of just iostream
* Uses unnecessary headers (which increase compile time)
* Uses both C and C++ stream IO (they may not be compatible so just use one or the other).
#include <iostream>int main (int argc, char *argv[]){ std::cout << "Hello World!" << std::endl; std::cout << "The size of an int is : \t\t" << sizeof (int) << " bytes." << std::endl; std::cout << "Press ENTER to continue..." << std::endl; std::cin.get (); return 0;}
Edit - is there NO WAY to get your code to look the same inside a code or source tag?
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
[edited by - siaspete on September 8, 2002 5:10:16 AM]
That shouldn''t matter, as new lines are just white space to the compiler.
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement