Created
March 31, 2022 13:41
-
-
Save marklocklear/47111890c1cc4c98385f13f81e09f2bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
string light; | |
cout << "What is the traffic light color?" <<endl; | |
cin >> light; | |
if(light == "green"){ | |
cout << "Go!" <<endl; | |
} | |
else if(light == "yellow"){ | |
cout << "Slow down!" <<endl; | |
} | |
else if(light == "red"){ | |
cout << "Stop!" << endl; | |
} | |
else{ | |
cout << "invalid entry" << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment