Speaking of C and C + + as the language of its predecessor, C is included language pemrograma n intermediate level.
Creator of C is Brian W. Kernighan and Dennis M. Ritchie in 1972. C is a programming language structured program divides into a number of blocks(sub-program). The aim is to facilitate the making and program development. Programs written
with C easily moved from one type of machine to another. it is due to the standardization of C is ANSI (American National Standards Institute) the reference compiler makers C.
C + + was created a decade after C. C + + was created by Bjarne Stroustroup
from Bell Laboratories, AT & T in 1983. Initially C + + named
"A better C". Name of C + + itself named by Rick Mascitti. The sign + +
derived from the increment operator in C language
,so for new lest try this u can do by part in part,and this is part one :
A. Hello World
Here is a sample C + + program that is simple
# include <iostream>
void main ()
{
cout << "Hello world. \ n";
}
Once compiled and dirun, the result is visible on the display Hello World.
B. Function main ()
Program C + + it will never be separated from the function / function. it is because it is a characteristic of OOP. A C + + program has at least one function the main (). This function is the beginning of the main program. Posts in main ()
is the name of the function, whereas part enclosed by {and} are called block (body function). In this case, an early sign of a block {and} are marks the end of the block. As in Pascal, the Pascal {identical to BEGIN, whereas identical} END. The command void means that the function main () does not return a value / value. How to write a function main () is not absolute as above. Here's how another writing
# include <iostream>
int main ()
{
cout << "Hello world. \ n";
return 0;
}
C. Statement
Command cout << "Hello world. \ N"; is one example
statement. Command is used to print the writing on the screen. Each statement must end with;
It is important to note here that the C + + program is
Case Sensitive, meaning uppercase and lowercase letters are considered different. Signs \ n is used to move the line.
D. file Header
In the example above, called iostream.h header file. The header file necessary for court orders can be executed. If the header file removed, there will be an error. To access the header file, use command # include <file header>, or # include "file header". In one program may involve more than one header file. Note:
Command cout << "Hello world. \ N";
can be replaced with printf ("Hello world. \ n");
However, to be able to use printf required header file stdio.h
E. Removing Screen
In C + +, the command clrscr (); used to remove / clean up
display. This command will be executed after adding the header file conio.h
# include <iostream>
# include <conio.h>
void main ()
{
clrscr ();
cout << "Hello world. \ n";
}
F. comment
You can add comments to your program. Here's the style for
add comments.
/ / ----------------------------------
/ / This is the first remarked
/ / ----------------------------------
or
/ * ----------------------------------
I remarked that this was the first
---------------------------------- * /
this is part one i will upgarde part two in page 2 or 3 later