Advertisement
InnaSibirova

traffic light

Oct 14th, 2019
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main() {
  5. string a, b, c;
  6.   cin >> a >> b >> c;
  7.   if (a == "black" && b == "black" && c == "green") {
  8.     cout << "black" << endl << "black" << endl << "GREEN";
  9.   } else if(a == "black" && b == "black" && c == "GREEN") {
  10.     cout << "black" << endl << "yellow" << endl << "black";
  11.   } else if(a == "black" && b == "yellow" && c == "black") {
  12.     cout << "red" << endl << "black" << endl << "black";
  13.   } else if(a == "red" && b == "black" && c == "black") {
  14.     cout << "red" << endl << "yellow" << endl << "black";
  15.   } else if(a == "red" && b == "yellow" && c == "black") {
  16.     cout << "black" << endl << "black" << endl << "green";
  17.   }  else if(a == "black" && b == "YELLOW" && c == "black") {
  18.       cout << "black" << endl << "YELLOW" << endl << "black";
  19.     } else {
  20.       cout << "error";
  21.     }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement