Saturday, March 11, 2017

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>
2
using namespace std;
3
int main( )
4 {
5
int numberOfLanguages;
6 cout << "Hello reader.\n"
7 << "Welcome to C++.\n";
8 cout << "How many programming languages have you used? ";
9 cin >> numberOfLanguages;
10
if (numberOfLanguages < 1)
11 cout << " Go back and read the Intro again. You may prefer\n"
12 << "a more elementary tuturial posts.\n";
13
else14 cout << "Enjoy the rest parts.\n";
15
return 0; 
// Created by https://NavidPlus.blogspot.com
16 }
 


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