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