Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Mattespelgrej(NUMEDMENY!!!11)
- //
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- int poang=0;
- int liv=5;
- int val;
- int svar;
- cout << "What kind of math would you like to work with today?" << endl << endl << endl;
- cout << "1. Addition" << endl << endl;
- cout << "2. Subtraction" << endl << endl <<endl <<endl <<endl <<endl;
- cout << "Rules:" <<endl <<endl;
- cout << "Every correct answer rewards you with one point."<<endl <<endl;
- cout << "Every incorrect answer removes one of your five lives." <<endl <<endl;
- cout << "After all five of your lives have run out, you lose." <<endl <<endl <<endl;
- cout << "USING A CALCULATOR COUNTS AS CHEATING!!!"<<endl;
- cin >> val;
- srand(time(0));
- if (val==1)
- {
- //Additionsdel
- do{
- int r1 = rand();
- int r2 = rand();
- int rsvar=r1+r2;
- cout << "What is" << endl << r1 << "+" << r2 << endl <<endl ;
- cout << "Points:" << poang << endl;
- cout << "Lives:" << liv << endl << endl;
- cin >> svar;
- if (svar==rsvar)
- { cout << "Correct!" <<endl <<endl ;
- poang++;
- }
- else
- { cout << "Incorrect!" <<endl << endl;
- liv--;
- }
- if (liv==0)
- { cout << "Preposterous." << endl << endl;
- }
- }while (liv>0);
- }
- //Subtraktionsdel
- else
- {
- do{
- int r1 = rand();
- int r2 = rand();
- int rsvar=r1-r2;
- cout << "What is" << endl << r1 << "-" << r2 << endl <<endl ;
- cout << "Points:" << poang << endl;
- cout << "Lives:" << liv << endl << endl;
- cin >> svar;
- if (svar==rsvar)
- { cout << "Correct!" <<endl <<endl ;
- poang++;
- }
- else
- { cout << "Incorrect!" <<endl << endl;
- liv--;
- cout << "Points:" << poang << endl;
- cout << "Lives:" << liv << endl <<endl ;
- }
- if (liv==0)
- { cout << "Preposterous." << endl << endl;
- }
- }while (liv>0);
- }
- if (poang<0);
- { cout << "How is this even possible" << endl <<endl ;
- else if (poang <10);
- {cout << "Congratulations. You're terrible at math." << endl << endl;
- }
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment