C++
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
I don't think stdin.h is a valid header file. What you want is stdioh, which has printf defined in it.Code: Select all
#include <stdin.h> main() { printf("Hello World\n"); }
Phreak
If you don't succeed, redefine success!
-
- Posts: 67
- Joined: Fri Jan 23, 2004 5:04 am
Just a warning.... If you are going to learn c++, give it your all! Don't skip any chapters! And don't expect results too fast.
I did all of these things, and I was discouraged a bit... but now... 2 years later, I have learned so much, and the possibilities of C++ are endless. It is very rewarding and very fun.
Good luck man!
ps, a good site with some nice forums for c/c++ is www.cprogramming.com
I did all of these things, and I was discouraged a bit... but now... 2 years later, I have learned so much, and the possibilities of C++ are endless. It is very rewarding and very fun.
Good luck man!
ps, a good site with some nice forums for c/c++ is www.cprogramming.com
My advice would be to read it cover to cover first time, don't worry if it goes over your head a little because you can then jump to certain chapters once you know the way around the book. Don't expect to read it once and then just know C++, it's too complicated to do that. I still reference to a few C++ books my bro has when I'm in trouble.c_olin3404 wrote:Just a warning.... If you are going to learn c++, give it your all! Don't skip any chapters! And don't expect results too fast.
I did all of these things, and I was discouraged a bit... but now... 2 years later, I have learned so much, and the possibilities of C++ are endless. It is very rewarding and very fun.
Good luck man!
ps, a good site with some nice forums for c/c++ is www.cprogramming.com
No, void main() is not a standard. Some compilers alows it, but official ANSI C++ standard forbids it.Unarekin wrote:No, void main(). He isn't returning a value. If he were to put int main(), he would need to have, say, 'return 0;' at the end.Robomaniac wrote:int main()
And AFAIR you can define function w return type other then void and still don't use return in it's body. Some compilers will only give you warning about this. And others won't even warn you
Tomasz Nowakowski
Openoko - www.openoko.pl
Openoko - www.openoko.pl
Only for old c++ headers, for most (or even all, i don't remeber) c header we add "c" in the begining and drop ".h". So "stdio.h" changes into "cstdio".Coolkat wrote:it's not #include <stdin.h> it's #include <stdio.h> and for C++ you don't need the .h at the end..
Tomasz Nowakowski
Openoko - www.openoko.pl
Openoko - www.openoko.pl
It's bad form to define a return type and not return anything.warui wrote:No, void main() is not a standard. Some compilers alows it, but official ANSI C++ standard forbids it.Unarekin wrote:No, void main(). He isn't returning a value. If he were to put int main(), he would need to have, say, 'return 0;' at the end.Robomaniac wrote:int main()
And AFAIR you can define function w return type other then void and still don't use return in it's body. Some compilers will only give you warning about this. And others won't even warn you
Never said anything was bad about it, just that the return value was never specified.Coolkat wrote:and what is so bad about sticking alittle return 0; at the end of a function?
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact:
Dev C++ borks on void main if i remember, i just use int main and add a return 0;
or if i feel like it
bool main
return true;
just whatever i feel
@duomaxwl -> Aim me if your having a little trouble, i can help you with some small stuff, however, i will not teach you everything you need, just if you need some help
or if i feel like it
bool main
return true;
just whatever i feel
@duomaxwl -> Aim me if your having a little trouble, i can help you with some small stuff, however, i will not teach you everything you need, just if you need some help
I hope you aren't misunderstanding me: I meant to say it's bad form to declare a return type for a function, then not return anything. Then again, I rarely rarely rarely write a function without it returning something.Tyn wrote:Also, it isn't bad form for the main function to have a return value of nothing, it's actually the standard. It's bad form to have void main() although most compilers allow it.
-
- Posts: 602
- Joined: Sat Aug 23, 2003 2:03 am
- Location: Pottstown, PA
- Contact: