July 2000
Intermediate to advanced
1280 pages
34h 55m
English
Listing 2.1 shows the source code for your first C++ program. It welcomes you to the world of C++ (as most first programs in programming language books do). In addition, just to demonstrate more features than a canonical "Hello World" program does, it makes some simple computations and prints the result of raising the value of pi (3.1415926) to the power of two.
#include <iostream> // preprocessor directive #include <cmath> // preprocessor directive using namespace std; // compiler directive const double PI = 3.1415926; // definition of a constant int main(void) // function returns integer { double x=PI, y=1, z; // definitions of variables cout << "Welcome to the C++ world!" ... |
Read now
Unlock full access