July 12th, 2004 06:18 PM
I've recently started hoarding C++ tutorials to get my info from various sources. One problem though: The Dev-Cpp tutorial uses the header stdio.h and printf(scanf) functions.
Like one other tutorial I have follows this (and, honestly, I much prefer it). But the rest use another header in addition, iostream.h, which Dev-Cpp does not include (at least not under that name) and this command for IO: cout << / cin <<
Note: Dev does include some sort of iostream, which is basically a reference to another header, but it doesn't seam to work with cout <<.
I'm a newb (just re-stating the obvious). Which header works with what, and which is most common (function)
\"I ONLY DRINK THE BLOOD OF MY ENEMIES....and maybe a strawberry yoohoo....and a...Pina Co-la-da!...
If you like pina coladas....ugh!, gettin\' caught in the rain....ugh!\"
July 12th, 2004 06:59 PM
stdio.h, printf() and scanf() are all C functions. That doesn't mean you can't use them in C++, just that C++ provides alternatives. iostream.h, cin and cout are C++ only things. My version of Dev C++ does cin and cout fine, as should any C/C++ compiler.
July 12th, 2004 07:55 PM
I think of C++ as a superset of C. Everything that I can do in C can also be done in C++. That does not mean that everything I can do in C++ can be done in C. The tutorieals that use printf or scanf are valid for C++ even through they are C functions.
If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
-- former White House cybersecurity adviser Richard Clarke
July 13th, 2004 09:02 AM
With some compilers, however, it matters what the extension on the file is. Sometimes they won't be keen on even trying to interpret a .c file as anything other than c. So you might have an issue there, sometimes, if you're not careful.
Other than that it has already been stated where the functions are. For gcc a lot of the basic [like scanf()/printf()] functions don't even need a header to be declared [although doing so ensures better portability]
July 20th, 2004 05:31 AM
Try using either of the Stdio.h or iostream.h, i am not not sure, but can try.
U get What U pay for.