Read the whole bit of code, THEN answer. There need to be spaces before and after the line. You can't use four cout statements like that, not even four printf statements.
READ THE WHOLE THREAD AND EVERY WHOLE CODE SNIPET.
Coldest regards,
-Albatross
P.S.- We didn't need string.h, stdio.h is too useful to be deprecated when the next C++ comes out, and you're right about void main(), g++ won't even let me compile it.
stdio.h is C, not C++. The only reason it exists in C++ is for C compatibility, and even then, it is called <cstdio>.
2: TYPE CHECKING. If someone enters "five" instead of 5, your program is screwed. This is why I recommend stdio.h, it does a form of type checking for you.
No, cstdio doesn't do ANY type checking. In fact, instead of checking, it just writes anyway, usually corrupting memory if you didn't get it right. C++ however will just set the error bit (which you should be checking anyway).
Indeed, stdio.h is C, however I haven't found one default C++ library that didn't include it, and that's all I'm saying. And personally, I can't see ANSI deprecating it. It's so useful...
I was under the impression that there was some minimal form of type checking... hmm... then I guess I never messed around with it enough.
Either way, the post has been edited, and I think it might be a good idea to stop posting on this thread. I solved his problem, albeit in arguably archaic ways, and now we're just bantering about <iostream> vs <cstdio>. We should probably stop, or this thread might descend into hell... >:(
-Albatrossatan
EDIT: P.S.- Could saying that stdio is better than iostream be considered trolling in this forum?