Intro to C++ Part 6

A Sample C++ Program  

##include <iostream>
using namespace std;The following line says that main is a function with no parameters that returns an int(integer) value:int main( )Some compilers will allow you to omit the int or replace it with void, which indicates
a function that does not return a value. However, the previous form is the most
universally accepted way to start the 
main function of a C++ program.
The program ends when the following statement is executed:
return 0;  

1 #include <iostream>
using namespace std;
int main( )
4 {
int numberOfLanguages;
6 cout << "Hello reader.\n"
7 << "Welcome to C++.\n";
8 cout << "How many programming languages have you used? ";
9 cin >> numberOfLanguages;
if (numberOfLanguages < 1)
11 cout << " Go back and read the Intro again. You may prefer\n"
12 << "a more elementary tuturial posts.\n";
else14 cout << "Enjoy the rest parts.\n";
return 0; 
// Created by
16 }

// Update 1: Kindly, you have to remove all the lines numbers.
Post a Comment

Popular Posts