Now that we know how to include the headers for printing to the screen
and reading from the keybord, we're ready to talk about
So how do we give this cout thing data, you ask? This is the neat part. You use
a syntax that really looks like what it does. Let's try using #include <iostream.h> void main(void) { cout << "Hello, World!"; } Note: You might not recognize a bit of the stuff here. Don't worry about it, all will be revealed in chapter 3. Think of the stuff you don't recognize as the "Begin" and "End" of C++.
Notice the << symbols? They are symbolic of arrows, and might give the
impression that the string "Hello, World!" is pointing to write('Hello, World!');
Of course, as the above Pascal may have tipped you off, this statement does not
do a carriage return at the end to go down to the next line. How can we do
that? Luckily, C++ defines another mystery object, called cout << "Hey World! It's me again. Got any Tacos?"; cout << endl; |