is a deprecated header, and was never part of standard C++. I'm assuming you're using VC++6.0 or a similarly older version of Borland. The standard header is so you may have to change it between school and home. You may consider raising the issue with your teacher, but there's a chance that he doesn't care, or may even get mad at you.
I really want to start working with and printf() but I don't think my teacher would accept the work, since he's hellbent on getting us to code with older techniques. (Seems like the lines we're writing aren't very "hip" anymore, since everywhere I look outputs are accomplished with printf() and such.)
printf() is the C way of managing output, and it's much older than C++ output using cout. ;)
Infarction
Posting Virtuoso
1,580 posts since May 2006
Reputation Points: 683
Solved Threads: 53
> We've been told to work with for our input and output
Your compiler probably doesn't support it because that header is old and outdated. Try using the Standard Template Library; it's up-to-date and you'll notice the headers don't have a file extension:
#include <iostream>
using namespace std;
> I really want to start working with and printf()
You're confusing C and C++. stdio.h and printf() are actually C functions. For now, stick with the C++ and the standard template library.
> but I don't think my teacher would accept the work
There is nothing incorrect about using modern coding methods, nor is there any reason why you should revert to outdated libraries. The snippet I showed you above is correct; using iostream.h is not. If he disapproves of it, show him this link .
> since everywhere I look outputs are accomplished with printf() and such.
Actually C++ was invented after C, so printf() and scanf() are actually older than cin and cout. Both languages have their advantages and disadvantages, and although you can mix them, it's generally not a good idea unless you know what you're doing.
John A
Vampirical Lurker
7,630 posts since Apr 2006
Reputation Points: 2,240
Solved Threads: 339
be sure to use the correct namespace when addresses those methods.
They're in the std namespace (and have been for the last 10 years or so, so since just after your book was published).
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337