In C + + programming language for looping (looping), the most commonly used is the For statement. For statement is useful for looping (looping) of one or a number of statements.
A simple example is to show the writing C + + as much as 10 times, like the example program below:
A simple example is to show the writing C + + as much as 10 times, like the example program below:
#include <iostream.h> #include <conio.h> void main() { clrscr(); int i; for(i=0; i<10; i++) { cout<<"C++"<<endl; } getch();}
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.
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 comments on Sample Statement For Simplified In C + + Program :
Post a Comment and Don't Spam!
Dont Spam please