Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>       //I love strings
  3. #include <cctype>       //I love "C" characters too
  4. using namespace std;
  5. //fun with a switch
  6. int main() {
  7.     //comparing  ==, >, < , ! (in C++ = is assignment and == is compare)
  8.     //can combine above such as >= 9greater than or equal to) != (not equals)
  9.     bool keep_going = true;
  10.     string string1 = "Roger";
  11.     string string2 = "";
  12.      do{
  13.         if (string2.empty()) cout << "hint the correct answer is Roger" << endl;
  14.         cout << "Who is the smartest person in the room? [q to quit] ";
  15.         cin >> string2;
  16.         if ( string2 == "q") keep_going = false;
  17.         else {
  18.             if (string1 == string2) cout << "You pass this class\n";
  19.             else cout << "See you next semester\n";
  20.         }
  21.     } while (keep_going);
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement