Guest User

Untitled

a guest
Apr 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. // Mattespelgrej(NUMEDMENY!!!11)
  2. //
  3.  
  4. #include <iostream>
  5. #include <cstdlib>
  6. using namespace std;
  7. int main()
  8. {
  9. int poang=0;
  10. int liv=5;
  11. int val;
  12. int svar;
  13.  
  14. cout << "What kind of math would you like to work with today?" << endl << endl << endl;
  15. cout << "1. Addition" << endl << endl;
  16. cout << "2. Subtraction" << endl << endl <<endl <<endl <<endl <<endl;
  17. cout << "Rules:" <<endl <<endl;
  18. cout << "Every correct answer rewards you with one point."<<endl <<endl;
  19. cout << "Every incorrect answer removes one of your five lives." <<endl <<endl;
  20. cout << "After all five of your lives have run out, you lose." <<endl <<endl <<endl;
  21. cout << "USING A CALCULATOR COUNTS AS CHEATING!!!"<<endl;
  22. cin >> val;
  23. srand(time(0));
  24.  
  25. if (val==1)
  26. {
  27.  
  28. //Additionsdel
  29.  
  30. do{
  31.  
  32. int r1 = rand();
  33. int r2 = rand();
  34.  
  35. int rsvar=r1+r2;
  36.  
  37. cout << "What is" << endl << r1 << "+" << r2 << endl <<endl ;
  38. cout << "Points:" << poang << endl;
  39. cout << "Lives:" << liv << endl << endl;
  40. cin >> svar;
  41. if (svar==rsvar)
  42. { cout << "Correct!" <<endl <<endl ;
  43. poang++;
  44.  
  45. }
  46. else
  47. { cout << "Incorrect!" <<endl << endl;
  48. liv--;
  49.  
  50. }
  51. if (liv==0)
  52. { cout << "Preposterous." << endl << endl;
  53. }
  54. }while (liv>0);
  55. }
  56.  
  57. //Subtraktionsdel
  58.  
  59. else
  60. {
  61.  
  62. do{
  63. int r1 = rand();
  64. int r2 = rand();
  65.  
  66. int rsvar=r1-r2;
  67.  
  68. cout << "What is" << endl << r1 << "-" << r2 << endl <<endl ;
  69. cout << "Points:" << poang << endl;
  70. cout << "Lives:" << liv << endl << endl;
  71.  
  72. cin >> svar;
  73. if (svar==rsvar)
  74. { cout << "Correct!" <<endl <<endl ;
  75. poang++;
  76.  
  77. }
  78. else
  79. { cout << "Incorrect!" <<endl << endl;
  80. liv--;
  81. cout << "Points:" << poang << endl;
  82. cout << "Lives:" << liv << endl <<endl ;
  83. }
  84. if (liv==0)
  85. { cout << "Preposterous." << endl << endl;
  86. }
  87. }while (liv>0);
  88.  
  89. }
  90. if (poang<0);
  91. { cout << "How is this even possible" << endl <<endl ;
  92. else if (poang <10);
  93. {cout << "Congratulations. You're terrible at math." << endl << endl;
  94. }
  95. system("pause");
  96. return 0;
  97. }
Add Comment
Please, Sign In to add comment