Evo. G Tech Team Forum
Welcome to Evo. G Tech Team Forum. We have moved to a new website : www.evogtechteam.com

Thanks you.

by Evo. G Tech Team Management.

Intro to C++ programming

View previous topic View next topic Go down

Intro to C++ programming

Post by Rachael_C on May 24th 2014, 18:55


Writing a program is a good way to learn a programming language. Usually the first program a beginner writes a “Hello World” program. This program is simple, but it includes all the fundamentals:

[You must be registered and logged in to see this image.]

Let’s analyze the codes above:

Line 1 - // my first program in C++
Two slash signs ( // ) shows that words after the signs are your comment. Programmers usually use this signs to give short explanations about the codes. In this case, it is a short introduction of the program.

Line 2 - #include< iostream >
The harsh sign ( # ) is known as a preprocessor. #include< iostream > is known as header iostream, which allows the input and output operations of the program.

Line 3 – using namespace std;
This line tells the compiler to use functions that are part of the standard library, which allows you to use "cout" functions in the program. Semicolon ( ; ) is a sign that tells the compiler that your command has come to an end.

Line 5 – int main()
Declaration of a function. This line tells the compiler there is a function called “main”, and the function will return an integer (int).

Line 6 & 11 - “ { “  and  “ } ”
Beginning and ending signs of a complete function.

Line 7 - cout << “Hello World\n”;
“cout” here read as “C out”, used to display texts.” <<” is the insertion operators, used to indicate what to output. “\n” at the end of the line stands for a newline, which moves the cursor to the next line.

Line 9 - system (“PAUSE”);
A way to pause the program’s execution, it will wait for a keyboard input to continue.

Line 10 – return 0;
The program will return to the value of 0, means the program is running successfully and is returned.
Your program will look like:

[You must be registered and logged in to see this image.]


Posts : 13
Points : 23781
Reputation : 0
Join date : 2014-04-27

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum