i attached a program with the output that i had on a midterm the other day here -
http://img233.imageshack.us/img233/1...9191753941.jpg
the output being on the right.. i was wondering why the loop went through when k = 5? since k <= 4.
i attached a program with the output that i had on a midterm the other day here -
http://img233.imageshack.us/img233/1...9191753941.jpg
the output being on the right.. i was wondering why the loop went through when k = 5? since k <= 4.
k is incremented in the loop body immediately after that condition is checked.Originally Posted by ashlee
Next time, post the well indented code in [code][/code] bbcode tags instead of linking to an image.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
that means it'll go through one last time?k is incremented in the loop body immediately after that condition is checked.
You could put it that way, yes.Originally Posted by ashlee
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)