User-Agent: *
Allow: /

Custom Search

Rabu, 03 Desember 2008

Object oriented programming with TURBO C++ and Borlan C++ (part. 2)

Introduction to C program
1. Examples of programs:
# include
void main ()
(
Cout << "Hello, I C. \ N";
)
Save the program with the extension (. CPP), and then compile and execute the file, it will mincul dilayar:
"Hello, I C"
2. Function main ()
A program contains a minimum of C functions, yaitu fungsi main (), which is the beginning and end of the execution of C program.
From the above example, the sign () is used to clamp function arguments, namely that the value will be passed to the function. A "(" stated the early execution of the program and a ")" declare the end of the program execution.
Word that precedes the void main () is used to declare that this function does not have a return value.

3. Statement
Line:
Cout << "Hello, I C. \ N";
It is an example ebuah statement. In the example above, the statement is used to display the text enclosed by () to the screen. Writing a enclosed by a pair of double quotes ( "") called the constant string.
Generally a statement of the form that contains the instructions to rule the computer to do something like writing to the display screen, calculate arithmetic operations, reading data from the keyboard, and others.


4. COUT
Cout index (read: C out) is the object in the C. This item is included by C to lead the data to standard output (screen is normal).
Alerts <
In a string, character \ followed by characters that a certain single character. PDA example, the / n switch is the character line.

5. # Include
Line:
# include
Is a line that mengintruksikan to the compiler to insert another file (iostream.h) when the program is compiled. Files - files that end with. H called the header files in the file which contains many declarations, such as functions, variables, and others.
6. CLRSCR () To Remove Screen
Is a command for the normal display included in a program. The statement required for the purposes of this form:
clrscr ();

7. Style Writing Program
C programmers to give freedom to write in the form or style of the program, but the program should be in written form that is easily read by anyone. Provision of blank lines on a certain position will make the program easy to read.

8. Comments
It is an important part in a program because it helps programmers and other people to understand the program because the form of explanation - an explanation about the program or part - part of a program that can be the purpose / function of the program, the program created / revised, other information about the uses of a number of statements in the program.

(Flat libraries: Abdul Kadir, C Programming, Andi Offset, Print Edition II, II, 2006)

0 komentar:

free counters