It worked because on your machine, with your compiler, today, the iostream header also included other headers that were enough to expose the srand, rand, and time functions.
BTW, nice job on making the working program on your own. That is a feat.
It worked because on your machine, with your compiler, today, the iostream header also included other headers that were enough to expose the srand, rand, and time functions.
BTW, nice job on making the working program on your own. That is a feat.
there's a difference between what you can get away with and what's good programming styleOriginally Posted by Kybo_Ren
In this case it's neither good nor bad because C++ guarantees that not returning a value is equivalent to returning 0. Some people prefer not to return anything, while some prefer to always return a value. Both are right.Originally Posted by Strait
Kampai!
Yes, in C++ if no return value is specified for main a return value of 0 is implied by the compiler. However just as with the arguments for casting malloc, this is considered bad programming practice and should be avoided. You should always explicitly return a value from main.In this case it's neither good nor bad because C++ guarantees that not returning a value is equivalent to returning 0. Some people prefer not to return anything, while some prefer to always return a value. Both are right.
i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced
It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah
Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem
If you are not using the return value, then it is perfectly acceptable, IMO, to let the implicit return 0 do its job. It is not considered bad programming practice. You might consider it to be poor style, I think it is better style than adding an unnecessary return 0 to the end of your program. Either way it is a style issue, and has no effect on the actual program under a standards conforming compiler.Originally Posted by andyhunter
Well, I wouldn't call it poor programming style, as it is rather nicely defined what it does (returns 0 which is the standard for a successful exit). Instead of saying that you don't have to return a value, though (as it clearly does return a value), I'd word it as, "you don't have to explicitly return a value."
Cheers
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
http://www.research.att.com/~bs/bs_faq2.html#void-main
Originally Posted by Bjarne Stroustrup
Sooooooo...... anyone have a suggestion for a program that I could make?
My computer is awesome.
You know it is a real shame that people do not take the time to truly see what this board has to offer. A lot of thought evidently went into the design and yet everyone always skips over everything and goes straight for the discussion boards. Yes, we all like attention - but please.
Why don't you have a look here . It is something very useful that will help you practice and improve your programming skills.
i don't think most standard compilers support programmers with more than 4 red boxes - Misplaced
It is my sacred duity to stand in the path of the flood of ignorance and blatant stupidity... - quzah
Such pointless tricks ceased to be interesting or useful when we came down from the trees and started using higher level languages. - Salem
wow i still have no idea what im doing
Try to make a basic calculator that will ask each number separately:
Output: What operation do you need ?
Input: +
Output: a ?
Input: 5
Output: b ?
Input: 6
Output: 11