Newbie C++

Started by
6 comments, last by PinguinDude 21 years, 7 months ago
#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
http://sourceforge.net/projects/pingux/ <-- you know you wanna see my 2D Engine which supports DirectX and OpenGL or insert your renderer here :)
Advertisement
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.
i use DevC++ 5 and there is only one error
http://sourceforge.net/projects/pingux/ <-- you know you wanna see my 2D Engine which supports DirectX and OpenGL or insert your renderer here :)
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
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]
Put all the (second) cout on one line.
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
i got the problem
Its an bug in DevC++ 5 because when i do it in DevC++4 it works fine
http://sourceforge.net/projects/pingux/ <-- you know you wanna see my 2D Engine which supports DirectX and OpenGL or insert your renderer here :)

This topic is closed to new replies.

Advertisement