Sunday, November 16, 2008

Learnings (betinol)

November 10-14

We had an individual work this time!!

Seriously I really don't know how it works but I discovered it step by step through time.

Though my work is incomplete and misplaced some marks, but still learned.

The for Statement


- the for loop provides a compact syntax for iteration
- typically used for counting loops, but can be used for any loop
- allows you to specify the following all on one line
1) initialization statement(s)
2) Boolean expression for continuing loop
3) statements to be executed after loop

// for loop syntax
for ( initialization; Boolean expression ; increment )
{
statements to be repeated
}

// for loop example
for (Num = 0; Num < 10; Num = Num+1)
{
cout << Num << "cubed=" << Num*Num*Num << endl;
}

No comments: