Pages

Rabu, 13 April 2011

Contoh Pernyataan For Sederhana Dalam Program C++ (Sample Statement For Simplified In C + + Program)

# include <iostream>
02 # include <conio.h>
03
04 void main ()
05 {
06 clrscr ();
07 int i;
08 for (i = 0; i <10; i + +)
09 {
10 court <<"C ++"<< endl;
11}
12 getch ();
13}

Simplified Explanation of Statement For Program C + + In the above:

First we create a new variable i of type integer. In a statement for, i was given the initial value is 0. Then do the test if i <10, because the result is true the statements inside the For executed. Then do the increment of i in the statement i + +. Then performed the test again if i <10. If yes (true) then in the For statement is executed, if not then the program continues into the bottom of For. And so on until the test i <10 is false.

0 komentar:

Posting Komentar