#include <iostream>
using namespace std;
int main(){
char c1, s1, c2, s2;
cin >> c1;
cin >> s1;
cin >> c2;
cin >> s2;
bool colComp (c1 - c2 <= 1 && c1 - c2 >= -1), strComp (s1 - s2 <= 1 && s1 - s2 >= -1);
if (c1 == c2 && s1 == s2){
cout << "NO";
}
else if (colComp && strComp){
if (c1 <= 0 || s1 <= 0 || c2 <= 0 || s2 <= 0){
else {cout << "YES";}
else {cout << "NO";}
return 0;
Объяснение:
#include <iostream>
using namespace std;
int main(){
char c1, s1, c2, s2;
cin >> c1;
cin >> s1;
cin >> c2;
cin >> s2;
bool colComp (c1 - c2 <= 1 && c1 - c2 >= -1), strComp (s1 - s2 <= 1 && s1 - s2 >= -1);
if (c1 == c2 && s1 == s2){
cout << "NO";
}
else if (colComp && strComp){
if (c1 <= 0 || s1 <= 0 || c2 <= 0 || s2 <= 0){
cout << "NO";
}
else {cout << "YES";}
}
else {cout << "NO";}
return 0;
}
Объяснение:
using namespace std;
int main()
{
cout << "Enter month num: " << endl;
unsigned month = 0;
cin >> month;
if (month <= 12 && month >= 1) {
switch (month / 3) {
case 1:
cout << "Spring" << endl;
break;
case 2:
cout << "Summer" << endl;
break;
case 3:
cout << "Autumn" << endl;
break;
default:
cout << "Winter" << endl;
break;
}
} else {
cout << "NO" << endl;
}
return 0;
}