Guest User

simple programming question

a guest
May 13th, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int a;
  8. int b;
  9. int c;
  10. int d;
  11. int e;
  12. int f;
  13. int g;
  14. int aa;
  15. int bb;
  16. int cc;
  17. int dd;
  18. int ee;
  19. int ff;
  20. int gg;
  21. int sum;
  22.  
  23. cout << "Welcome to the Basic Mathematics Quiz!" << endl;
  24. cout << "This quiz will test you on your Addition, Subtraction, Multiplication, and Division skills." << endl;
  25. cout << endl;
  26. cout << "Let's begin!" << endl;
  27. cout << endl;
  28. cout << "What is 2 + 2?" << endl;
  29. cin >> a;
  30. if(a==4){
  31. cout << "Correct. Next problem..." << endl;
  32. aa = 1;
  33. }
  34. if (a!=4){
  35. cout << "Incorrect. Next problem..." << endl;
  36. aa = 0;
  37. }
  38. cout << endl;
  39. cout << "What is 10 - 5?" << endl;
  40. cin >> b;
  41. if (b==5){
  42. cout << "Correct. Next problem..." << endl;
  43. bb = 1;
  44. }
  45. if (b!=5){
  46. cout << "Incorrect. Next problem..." << endl;
  47. bb = 0;
  48. }
  49. cout << endl;
  50. cout << "What is 15 * 2?" << endl;
  51. cin >> c;
  52. if (c==30){
  53. cout << "Correct. Next problem..." << endl;
  54. cc = 1;
  55. }
  56. if (c!=30){
  57. cout << "Incorrect. Next problem..." << endl;
  58. cc = 0;
  59. }
  60. cout << endl;
  61. cout << "What is 50 / 25?" << endl;
  62. cin >> d;
  63. if (d==2){
  64. cout << "Correct. Next problem..." << endl;
  65. dd = 1;
  66. }
  67. if (d!=2){
  68. cout << "Incorrect. Next problem..." << endl;
  69. dd = 0;
  70. }
  71. cout << endl;
  72. cout << "Using the order of operations, what is 5 + 10 * 5 - 10?" << endl;
  73. cin >> e;
  74. if (e==45){
  75. cout << "Correct. Next problem..." << endl;
  76. ee = 1;
  77. }
  78. if (e!=45){
  79. cout << "Incorrect. Next problem..." << endl;
  80. ee = 0;
  81. }
  82. cout << endl;
  83. cout << "Using the order of operations, what is 2 / 10 * 5 + 15?" << endl;
  84. cin >> f;
  85. if (f==40){
  86. cout << "Correct. Next problem..." << endl;
  87. ff = 1;
  88. }
  89. if (f!=40){
  90. cout << "Incorrect. Next problem..." << endl;
  91. ff = 0;
  92. }
  93. cout << endl;
  94. cout << "Using the order of operations, what is 10 * 10 + 100 / 2 - 50?" << endl;
  95. cin >> g;
  96. if (g==100){
  97. cout << "Correct. Next problem..." << endl;
  98. gg = 1;
  99. }
  100. if (g!=100){
  101. cout << "Incorrect. Next problem..." << endl;
  102. gg = 0;
  103. }
  104. cout << endl;
  105.  
  106. cout << "Test Complete!" << endl;
  107. if (aa + bb + cc + dd + ee + ff + gg == 7){
  108. cout << "You made a 7/7! " << 100/7*7 << "% Score!" << endl;
  109. }
  110. if (aa + bb + cc + dd + ee + ff + gg == 6){
  111. cout << "You made a 6/7! " << 100/7*6 << "% Score!" << endl;
  112. }
  113. if (aa + bb + cc + dd + ee + ff + gg == 5){
  114. cout << "You made a 5/7! " << 100/7*5 << "$ Score!" << endl;
  115. }
  116. if (aa + bb + cc + dd + ee + ff + gg == 4){
  117. cout << "You made a 4/7! " << 100/7*4 << "% Score!" << endl;
  118. }
  119. if (aa + bb + cc + dd + ee + ff + gg == 3){
  120. cout << "You made a 3/7! " << 100/7*3 << "% Score!" << endl;
  121. }
  122. if (aa + bb + cc + dd + ee + ff + gg == 2){
  123. cout << "You made a 2/7! " << 100/7*2 << "% Score!" << endl;
  124. }
  125. if (aa + bb + cc + dd + ee + ff + gg == 1){
  126. cout << "You made a 1/7! " << 100/7*1 << "% Score!" << endl;
  127. }
  128. if (aa + bb + cc + dd + ee + ff + gg == 0){
  129. cout << "You made a 0/7! " << 100/7*0 << "% Score!" << endl;
  130. }
  131.  
  132. return 0;
  133. }
Advertisement
Add Comment
Please, Sign In to add comment