5)
#include <iostream>
using namespace std;
int main() {
int m;
cin >> m;
switch (m)
{
//31
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
cout << 31 << endl;
break;
//30
case 4: case 6: case 9: case 11:
cout << 30 << endl;
//28
case 2:
cout << 28 << endl;
default:
cout << "Error!"<<endl;
}
8)
int a, b;
cin >> a;
cin >> b;
if (a > b)
cout << a << endl << b;
else
cout << b << endl << a;
Объяснение:
5)
#include <iostream>
using namespace std;
int main() {
int m;
cin >> m;
switch (m)
{
//31
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
cout << 31 << endl;
break;
//30
case 4: case 6: case 9: case 11:
cout << 30 << endl;
break;
//28
case 2:
cout << 28 << endl;
break;
default:
cout << "Error!"<<endl;
break;
}
}
8)
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a;
cin >> b;
if (a > b)
cout << a << endl << b;
else
cout << b << endl << a;
}
Объяснение: