O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Enhancing the Empty Program

Your first task is to add a line to the empty program so it won't be empty any longer. That line will display the program result.

Listing 2.1 shows the new version of main.cpp. A star before the line number indicates that the line is new. Do not enter the *, the line number, or the : in your code. These marks and numbers are only shown to help you to connect descriptions of the code with lines from the example.

Listing 2.1. main.cpp Enhancements to Display a Result
 *1: #include <iostream>
 *2:
 *3: using namespace std;
 *4:
  5: int main(int argc, char* argv[])
  6: {
 *7:    // Without "using" statement, this would be std::cout
 *8:    cout << "Hi there!" << endl;  // "endl"  = next line
  9:    return 0;
*10: }
Hi there!

This program ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required