Пример 6
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
int month;
cout << "Please enter number of the month: ";
cin >> month;
switch (month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
cout << "There are 31 days in month # " << month << endl;
break;
case 4: case 6: case 9: case 11:
cout << "There are 30 days in month # " << month << endl;
break;
case 2:
cout << "There are 28 or 29 days in February" << endl;
break;
default:
cout << "Invalid input" << endl;
break;
}
system("PAUSE");
return EXIT_SUCCESS;
}
<== попередня сторінка |
| |
наступна сторінка ==> |
Пример 5 | | | Пример 7 | Переглядів: 301
Не знайшли потрібну інформацію? Скористайтесь пошуком google:
|
|