Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
REG 2.18 KB | None | 0 0
  1. // ~~~~~~~~~~~ GAM 130 Mid Term Exam ~~~~~~~~~~~~~
  2.  
  3. // I wrote this program while simultaneously riding a jet ski and
  4. // filing my income tax return and for some strange reason it doesn't work.
  5. // Since I'm the manager and can't be bothered to do my own work, I need
  6. // you to fix it. Oh, and I need it by noon. Have fun!
  7.  
  8. // Please include a comment on every line that you change describing what change you made
  9.  
  10. // Save your finished .cpp file on your z drive in a folder named "GAM130", or email it to me.
  11.  
  12. #include <iostream>
  13. //iostream, not ioscream
  14. #include <string>
  15.  
  16. using namespace std;
  17.  
  18. int main()
  19. {
  20.     string response[6];  
  21.     //wrong brackets were here
  22.  
  23.     response[0] = "What do I know?  I been drinkin' in the alley all morning.";
  24.     response[1] = "My sources say...sure, whatever.";
  25.     response[2] = "Yes, as soon as the economy turns around.";
  26.     response[3] = "I'm not sure if you would want that anyway.";
  27.     response[4] = "Seriously? No.";
  28.     response[5] = "Probably, but not any time soon.";
  29.  
  30.     cout << "Welcome to the GAM130 Magic 8-Ball (without the 8-ball, of course)" << endl << endl;
  31.  
  32.     cout << "First, type in a yes or no question: " << endl;
  33.     //forgot a ; at the end of line
  34.     string question;
  35.     getline(cin, question);
  36.  
  37.     int responseNum;  
  38.     //spelled int incorrectly
  39.     cout << endl << "Now, pick a number between 1 and 100: ";
  40.     cin >> responseNum;
  41.  
  42.     if(responseNum > 0 || responseNum <= 15) {              
  43.         cout << endl << response[0] << endl << endl;
  44.     } else if(responseNum > 15 || responseNum <= 30) {
  45.         cout << endl << response[1] << endl << endl;
  46.     } else if(responseNum > 30 || responseNum <= 45) {
  47.         cout << endl << response[2] << endl << endl;
  48.     } else if(responseNum > 45 || responseNum <= 60) {
  49.         cout << endl << response[3] << endl << endl;
  50.     } else if(responseNum > 60 || responseNum <= 75) {
  51.         cout << endl << response[4] << endl << endl;
  52.     } else if(responseNum > 75 || responseNum <= 100) {
  53.         cout << endl << response[5] << endl << endl;
  54.     }
  55.     //was missing a closing }
  56.      
  57.  
  58.     cout << "Thanks for playing!! Come back and ask another question soon!" << endl;  
  59.     //arrows were facing the wrong way for cout , >> not <<
  60.     cin.get();
  61.     cin.get();
  62.     return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement