Poobah
New member
That's odd. I've attached the two books. (I have local mirrors of 'em.)Iconoclast said:*Edit: Your tutorial link didn't work.
That's odd. I've attached the two books. (I have local mirrors of 'em.)Iconoclast said:*Edit: Your tutorial link didn't work.
Here's the deal...xneoangel said:I'm having some advance in C++ coding, i have already played a bit with basic variables and strings, but well its weird in the tutorial i'm doing every sample program ends up with:
return 0;
i don't know what that commad does as the program works even if i dont put it at the end, so its kinda weird what does that line do?
And also since i'm starting i'm only making console based programs which display something on-screen but when i execute the program the program shows me the stuff but it dissapears instantly, is there a line of code i can introduce to put a dealy time of about 5 seconds before it closes or to close it only when i press the X button?
No, not exactly. The compiler only generates the code and the computer only follows instructions. When you return a value from main, it is what program that started your app that decides what to do with it. When you return a value from main, however, it is assumed that it means success or failure, but it mustn't be so.xneoangel said:Ok so return (any value); basically gives the computer the value i selected to indicate the program worked ok and closes it?
Ah, yes forgot that!Oh and do you know some code i can introduce in this console based apps so that i doesnt colse after it executes but when i close it manually?
int buf;
cin >> buf;