C++ Programming Language. (Introduction)

Posted: August 8, 2012 in Uncategorized

Any program is a set of functions that the processor has to execute to give the user the required output.

A function is a set of instructions that the program executes when the function is called by the program at a certain time.

The main function is what the processor search for to start executing the program, in other words, the main function is the first function being executed by the processor. The main function can call then other functions within the program to execute certain action.

To write the program code, you most of the time will execute some predefined functions, like for example the writing and reading function which in C++, we call them cout and cin. These 2 functions were already defined in a library that allows your program to understand the functionalities iostream. I made a very small application, in the following part to help you better understanding how to start writing code. The namespace std is what allows your application to consume the standard functionalities.

For example:

#include <iostream>

using namespace std;

int add(int x, int y)

{

    return x+y;

}

int main()

{

    cout << add(4,4);

    return 0;

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s