Operating Systems > Linux and UNIX

Turbo C

<< < (2/2)

flap:
Well basically because C++ features cout as part of its ostream class, but the stdio library is still available as well.

jtpenrod:

quote:basic c/c++ question:
why does c++ have 2 print commands?
printf from stdio, and cout from iostream?
--- End quote ---
The reason for that is really quite simple: C++ is basically a superset of C, and as such, includes everything available in C itself. C++ commands such as: cout and cin are C++ objects that encapsulate the same operations that printf does.
_____________________________________
Live Free or Die: Linux

Their fundamental design flaws are completely concealed by their superficial design flaws.

jtpenrod:

--- Code: ---
--- End code ---
First off, the syntax is incorrect. Try this instead:

--- Code: ---
--- End code ---
Secondly, there's a problem with running a console app in Winderz that you don't have with Linux. You need to cause the program to pause and busy-wait before it exits. That's why you add "getchar" so the program will wait for a character from the keyboard. Otherwise, the program outputs the "Hello" and exits so fast you'll never see it.

Just another wonderful Winderz "feature"        
____________________________________
Live Free or Die: Linux

Their fundamental design flaws are completely concealed by their superficial design flaws.

[ January 17, 2003: Message edited by: jtpenrod ]

voidmain:
My experience on the old days was all you had to do was add a "\n" to actually make it flush the IO with a CR. Will this not work today?

flap:
It should work without that.

Navigation

[0] Message Index

[*] Previous page

Go to full version