csc110 2010 April 13

Posted in csc110 by bnmng on 2010 04/13

Program due Thursday.


Read 8.1, 8.2 Bronson

Test 3

Free time for questions and help with test.

– – – –

Going over test:

The output of the first loop goes from 1 to 9.
Even though it starts with I equaling zero, it increments before the first cout, so it couts after i++, when I equals one.
Even though the test was i<=8, it passes the <=8 test, then increments, then couts. Now it’s 9 and fails the test for the next time around, so the loop ends. But that’s after it incremented and printed.

The second loop prints from zero to 8. It starts with i equaling zero. Since i equals zero, it passes the test, then couts. Since it counts before it increments, it couts zero. It increments to 1, but before it couts, it it passes the test again. Then it couts with I equaling 1, then i increments. When i increments to 8, it passes the test and couts. Than i gets incremented so it equals 9. But even though i makes it to 9, it never gets couted as 9, because it fails the test before it prints.

Using Functions:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: