Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ~~~~~~~~~~~ GAM 130 Mid Term Exam ~~~~~~~~~~~~~
- // I wrote this program while simultaneously riding a jet ski and
- // filing my income tax return and for some strange reason it doesn't work.
- // Since I'm the manager and can't be bothered to do my own work, I need
- // you to fix it. Oh, and I need it by noon. Have fun!
- // Please include a comment on every line that you change describing what change you made
- // Save your finished .cpp file on your z drive in a folder named "GAM130", or email it to me.
- #include <iostream>
- //iostream, not ioscream
- #include <string>
- using namespace std;
- int main()
- {
- string response[6];
- //wrong brackets were here
- response[0] = "What do I know? I been drinkin' in the alley all morning.";
- response[1] = "My sources say...sure, whatever.";
- response[2] = "Yes, as soon as the economy turns around.";
- response[3] = "I'm not sure if you would want that anyway.";
- response[4] = "Seriously? No.";
- response[5] = "Probably, but not any time soon.";
- cout << "Welcome to the GAM130 Magic 8-Ball (without the 8-ball, of course)" << endl << endl;
- cout << "First, type in a yes or no question: " << endl;
- //forgot a ; at the end of line
- string question;
- getline(cin, question);
- int responseNum;
- //spelled int incorrectly
- cout << endl << "Now, pick a number between 1 and 100: ";
- cin >> responseNum;
- if(responseNum > 0 || responseNum <= 15) {
- cout << endl << response[0] << endl << endl;
- } else if(responseNum > 15 || responseNum <= 30) {
- cout << endl << response[1] << endl << endl;
- } else if(responseNum > 30 || responseNum <= 45) {
- cout << endl << response[2] << endl << endl;
- } else if(responseNum > 45 || responseNum <= 60) {
- cout << endl << response[3] << endl << endl;
- } else if(responseNum > 60 || responseNum <= 75) {
- cout << endl << response[4] << endl << endl;
- } else if(responseNum > 75 || responseNum <= 100) {
- cout << endl << response[5] << endl << endl;
- }
- //was missing a closing }
- cout << "Thanks for playing!! Come back and ask another question soon!" << endl;
- //arrows were facing the wrong way for cout , >> not <<
- cin.get();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement