Created
October 22, 2012 07:28
-
-
Save itsjohncs/3930116 to your computer and use it in GitHub Desktop.
Classroom Session 4 - Fruit Example
This file contains hidden or 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 fruit; | |
cout << "Please enter a fruit: "; | |
cin >> fruit; | |
while (!(fruit == "apple" || fruit == "orange" || fruit == "pineapple")) { | |
cout << "That's not a fruit. Try again: "; | |
cin >> fruit; | |
} | |
cout << "I love " << fruit << "s!" << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment