any c++ forums for someone just starting to try to learn c++?Thanks
Printable View
any c++ forums for someone just starting to try to learn c++?Thanks
Hi,
Try this one: http://www.cplusplus.com/forum/
Am trying to learn on my own,have downloaded many things. Stuck on first program,it is just a simple Hellow World-but keep getting a syntax error.May have to take a class to get on right track.Thank You.
http://jethrojones.hyperlinx.cz/text...usplus_ch1.htm
Sorry for the spam, but that should clear some things up for you.
I like the Dev Bloodshed compiler. I recommend it to anyone who likes C or C++. Get it at http://www.downloads.com
Thank you jethro.Thank you JRoc.
#include <iostream.h>
int main()
{
cout<<"Hello World";
return 0;
}
thats the hello world.
i use the DJGPP compiler for windows.. it works fairly well DJGPP
gcc hello.c -o hello.exe
to compile with it.
Game Coding UK has some excellent forums for discussing all aspects of C++, including the game libraries that can be used and DirectX.
#include <iostream.h>
void main()
{
cout<<"Hello World";
}
Umm, doesn't that work also? Been a while since I wrote a c++ program, but it is a whole line shorter then xmaddness' program ;)
c/c++/c# site : www.cprogramming.com
souleman:
yes it works perfectly
but int main() should be prefered over void main() coz it will return a value back to the OS/parent program from where it was called. this indicates wether it was successful or not according to the return value.
void() is normally used for functions. though in small/basic programs there is no harm in using void main()
I call int main() and return 0 just for good measure. Its always good to make sure that you return the values to 0 after the program.
But as was said ihsir; that will work also, but if you begin to build more complicated programs, you may run into errors w/o the return 0 and int main() use.
And as far as the DJGPP goes. I got rid of it. It couldn't find iostream.h file for some reason, even though i have all my paths set correctly. Now I'm using borland 5.5 and its much better and easier.
Hello world in 2 lines
#include <iostream.h>
void main() { cout<<"Hello World"; }
Thanks for all the help,this book did not seem right.With your help it works now.
void main() is now outdated and shouldn't really be used, either in C or C++ programs. Most compilers won't complain, so long as you don't try and return a value, but it's good style to include the int delclaration. Also, gcc (the compiler for *nix) doesn't like void main() and will sometimes refuse to compile your program if it includes this line.