Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1.
The program validate.ccp first ask user to enter a date as the format of mm dd yyyy, and then the program will judge whether the input is valid or not. If the format is qualified, then the input will be display as the form of mm/dd/yyyy.
2.
= 3,
APRIL
= 4, MAY
= 5, JUNE
= 6,
JULY
= 7, AUGUST
= 8, SEPTEMBER = 9,
}; 3. 4. The name of the new type is MonthsOfYear The program will print out 4.
5.
The MonthOfYear will not function properly, because the elements in the enum type are not defined.
III.
switch (month) {
daysInMonth = 31;
break ;
case NOVEMBER :
daysInMonth = 30;
break ;
case FEBRUARY:
daysInMonth = daysInFebruary;
break ;
default:
exit(1) ;
6. 7. 8. 9.
If the input month is not valid, the output will be Invalid month: The break works as the end of the switch. The output shows that Invalid day of month: 31 enum CardSuit {SPADES, HEARTS, CLUBS, DIAMONDS} ;
10enum CardRank {ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK,
QUEEN, KING} ;
switch(suit_number)
break ;
break ;
break ;
break ;
switch(rank_number)
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
string RANK;
string SUIT;
switch(rank)
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
break ;
switch(suit)
break ;
break ;
break ;
break ;
cout << RANK << " of " << SUIT << endl ;