Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- string house_color_1, house_color_2, house_color_3, target_house_color;
- cin >> house_color_1 >> house_color_2 >> house_color_3 >> target_house_color;
- int house_number = 0;
- if (target_house_color == house_color_1) {
- house_number = 1;
- } else if (target_house_color == house_color_2) {
- house_number = 2;
- } else if (target_house_color == house_color_3) {
- house_number = 3;
- }
- if (house_number != 0) {
- cout << "Enter the house "s << house_number << endl;
- } else {
- cout << "Seek somewhere else"s << endl;
- }
- }
Advertisement
Comments
-
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string firstColor, secondColor, thirdColor, needColor;
- cin >> firstColor >> secondColor >> thirdColor >> needColor;
- int houseNum = (firstColor == needColor) + (secondColor == needColor) * 2 + (thirdColor == needColor) * 3;
- if (houseNum != 0) {
- cout << "Enter the house "s + to_string(houseNum) << endl;
- } else {
- cout << "Seek somewhere else"s << endl;
- }
- return 0;
- }
-
- #include <iostream>
- using namespace std;
- int main() {
- string h1, h2, h3, h_cat;
- cin >> h1 >> h2 >> h3 >> h_cat;
- if (h1 == h_cat) {
- cout << "Enter the house 1";
- return 0;
- }
- if (h2 == h_cat) {
- cout << "Enter the house 2";
- return 0;
- }
- if (h3 == h_cat) {
- cout << "Enter the house 3";
- return 0;
- }
- cout << "Seek somewhere else"s;
- return 0;
- }
-
- using namespace std;
- int main() {
- string dc1, dc2, dc3, pc;
- cout << "Enter the house X"s << endl;
- cin >> dc1 >> dc2 >> dc3 >> pc;
- if (pc == dc1 || pc == dc2 || pc == dc3) {
- if (pc == dc1) { cout << "Enter the house 1"s << endl; }
- if (pc == dc2) { cout << "Enter the house 2"s << endl; }
- if (pc == dc3) { cout << "Enter the house 3"s << endl; }
- }
- else {
- cout << "Seek somewhere else"s << endl;
- }
- }
-
- #include <iostream>
- using namespace std;
- int main() {
- bool Found=0;
- int i;
- string s[4];
- cin >>s[0]>>s[1]>>s[2]>>s[3];
- for (i=0; i<=2; i++)
- if (s[i] == s[3]){
- cout << "Enter the house "s << i+1 << endl;
- Found = 1;
- break;
- }
- if (!Found)
- cout << "Seek somewhere else"s << endl;
- }
-
- #include <iostream>
- using namespace std;
- int main() {
- string color1, color2, color3, color;
- // Считайте цвета трёх домов и цвет дома, где видели Пушистика
- cin >> color1 >> color2 >> color3 >> color;
- // Выведите Enter the house X, если дом нужного цвета имеет номер X
- if(color1 == color){
- cout << "Enter the house 1"s << endl;
- } else if(color2 == color){
- cout << "Enter the house 2"s << endl;
- } else if(color3 == color){
- cout << "Enter the house 3"s << endl;
- } // Выведите Seek somewhere else, если дома нужного цвета нет
- else {
- cout << "Seek somewhere else"s << endl;
- }
- }
-
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string house1, house2, house3, house4;
- cin >> house1 >> house2 >> house3 >> house4;
- if (house1 == house4) {
- cout << "Enter the house 1"s << endl;
- } if (house2 == house4) {
- cout << "Enter the house 2"s << endl;
- } if (house3 == house4) {
- cout << "Enter the house 3"s << endl;
- } if ((house1 != house4) && (house2 != house4) && (house3 != house4)) {
- cout << "Seek somewhere else"s << endl;
- }
- return 0;
- // трёх домов и цвет дома, где видели Пушистика
- // Выведите Enter the house X, если дом нужного цвета имеет номер X
- // Выведите Seek somewhere else, если дома нужного цвета нет
- }
-
Comment was deleted
-
- #include <iostream>
- using namespace std;
- int main() {
- string h1, h2, h3, h4;
- cin >> h1 >> h2 >> h3 >> h4;
- if (h4 == h1) {
- cout << "Enter the house 1"s << endl;
- } else if (h4 == h2) {
- cout << "Enter the house 2"s << endl;
- } else if (h4 == h3) {
- cout << "Enter the house 3"s << endl;
- } else {
- cout << "Seek somewhere else"s << endl;
- }
- }
-
- #include <iostream>
- using namespace std;
- int main() {
- // Считайте три целых числа: X и Y и их сумму
- // Если сумма указана неверно, выведите сообщение: "Error. The sum of X and Y is Z"
- // Вместо символов X, Y и Z выведите числа X и Y, а также правильное значение суммы
- int x, y, z;
- cin >> x >> y >> z;
- bool correct_range = ((x >= -1000000 || x <= 1000000) && (y >= -1000000 || y <= 1000000));
- if (correct_range) {
- if (x + y != z) {
- cout << "Error. The sum of " << x << " and " << y << " is " << x + y << endl;
- }
- }
- }
- //Со стандартного входа программе поступают три целых числа в диапазоне от -1'000'000 до +1'000'000 - из условия, поэтому добавил проверку..
Add Comment
Please, Sign In to add comment