Iteration
while: execute a statement as long as some condition is truedo while: similar to while but check condition after executing the statement.
for: execute a statement on every element of some data, or some fixed number of times.
while
int count = 0 ;
while ( count < 3) { cout << ” Hello ” << count << endl ; count ++; }
Output :
Hello
Hello
Hello
|
No comments:
Post a Comment