Archived

This topic is now archived and is closed to further replies.

Newbie C++

This topic is 5576 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).


#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]

Share this post


Link to post
Share on other sites