Tuesday, October 27, 2015


- Repetition/looping
 pengulangan sesuatu atau serangkaian proses yang terdapat di dalam program C++, looping juga terdapat 3 penggunaan :
1. For.
2. Do.
3. Do-While.
4. Repetition Operation
5. Break VS Continue

Break & Continue
 Fungsi dari break adalah untuk memberhentikan proses dari loopig, sedangkan
 Fungsi dari Continue melewatkan semua pernyataan dalam Looping terus dia tetap  ngelakukin looping selanjutnya.

Syntax For :

for(exp1; exp2; exp3) statement;
or:
for(exp1; exp2; exp3){
  statement1;
  statement2;
  …….
 }
exp1 :  initialization
exp2 :  conditional
exp3 :  increment or decrement

exp1, exp2 and exp3 are optional


Syntax While :


while (exp) statements;
or:
while(exp){
  statement1;
  statement2;
   …..

}

Syntax Do-While :

    < statements >;
} while(exp);
•
•Keep executing while exp is true
•exp evaluation done after executing the statement(s)


No comments:

Post a Comment