Untitled
unknown
plain_text
2 years ago
758 B
6
Indexable
#include <iostream>
using namespace std;
int yourKoresh(int age) {
/*int key=0;
if (age > 10) {
key = 1;
}
if (age > 20) {
key = 2;
}
if (age > 30) {
key = 3;
}
if (age > 40) {
key = 4;
}
switch (key) {
case 1: cout << "moldoy";
break;
case 2: cout << "bivaliy";
break;
case 3: cout << "starche";
break;
case 4: cout << "ne bivaet";
break;
default: cout << "perec";
}
} */
switch (age) {
case 10 ... 20:
cout << "moldoy";
break;
case 20 ... 30:
cout << "bivaliy";
break;
case 30 ... 40:
cout << "starche";
break;
case 40 ... 100: cout << "ne bivaet";
break;
default: cout << "perec";
}
}
int main()
{
int age;
cin >> age;
yourKoresh(age);
}
Editor is loading...