2.2. First Program in C++: Printing a Line of Text

Consider a simple program that prints a line of text (Fig. 2.1). This program illustrates several important features of the C++ language. The line numbers are not part of the source code.


 1   // Fig. 2.1: fig02_01.cpp
 2   // Text-printing program.
 3   #include <iostream> // allows program to output data to the screen
 4
 5   // function main begins program execution
 6   int main()
 7   {
 8      std::cout << "Welcome to C++! "; // display message
 9
10      return 0; // indicate that program ended successfully
11   } // end function main


Welcome to C++!


Fig. 2.1. Text-printing program.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.26.20