CHAPTER 5
Decision and loop statements
67
1.
Continue working with the project from the previous exercise.
2.
Modify the DisplayDate function. Rather than display the month as an integer, replace the
Console::Write(month) statement with a switch statement that displays the month as a string.
switch (month)
{
case 1: Console::Write("January"); break;
case 2: Console::Write("February"); break;
case 3: Console::Write("March"); break;
case 4: Console::Write("April"); break;
case 5: Console::Write("May"); break;
case 6: Console::Write("June"); break;
case 7: Console::Write("July"); break;
case 8: Console::Write("August"); break;
case 9: Console::Write("September"); break;
case 10: Console::Write("October"); break;
case 11: Console::Write("November"); break;
case 12: Console::Write("December"); break;
default: Console::Write("Unknown"); break;
}
Do'stlaringiz bilan baham: |