Thursday, July 21, 2011

Basic Structure Of C++

1. Structure Of Program 
declaration header file / preprocessor
begins with the # include <header name file>
constant declarations (optional)
global variable declaration (optional)
function declaration (optional)
declaration of class (optional)

The main program (main function)
main () {
     ... ....
     ... ... ..
}

2. Defining header
 Header is a function that supports the execution specific instructions in C + +

Some headers are often used:
iostream.h for instructions on court and cin
conio.h for instruction getch () and clrscr ()

stdio.h for instruction gets ()

3. Things to note 

a. Instruction to move the cursor on the following lines:
" \n "
<<endl;

b. Write a comment:
/ /
If only one line comment
/*.....*/
Very useful if more than one line comment.
 

c. C + + is case sensitive distinguish uppercase and lowercase letters, so that:
instructions should be written in lowercase
example:
court <<correct
Court <<incorrect
Variables are written with lowercase and uppercase letters are different.
example:
Variable 'X' will be distinguished by the variable 'x'
The variable 'number' will be distinguished by the variable 'Numbers'
 

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Best Web Hosting