3.
Build the application.
4.
Run the application several times, typing a different month each time. Verify that the applica-
tion displays the correct season name each time.
Performing loops
For the rest of this chapter, you’ll see how to perform loops in C++/CLI. You’ll also see how to perform
unconditional jumps in a loop by using the break and continue statements.
C++ has three main loop constructs: the while loop, the for loop, and the do-while loop.
Note There is actually a fourth loop type, the for-each loop, but I’ll leave discussing that
until we get to arrays.
Let’s look at the while loop first.
Using while loops
A while loop continues executing its body for as long as the condition in parentheses evaluates to
true. The following example shows how to write a simple while loop in C++/CLI:
Do'stlaringiz bilan baham: |