fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. char answers[5] = {'a', 'a', 'b', 'b', 'c'};
  6. char userAnswers[5];
  7. int score = 0;
  8.  
  9. cout << "Philippine History Quiz\n" << endl;
  10. cout << "Multiple Choice Only\n" << endl;
  11.  
  12. cout << "1. Who was the first President of the Philippines?\n";
  13. cout << " a) Emilio Aguinaldo\n b) Manuel L. Quezon\n c) José P. Laurel\n";
  14. cout << "Your Answer: ";
  15. cin >> userAnswers[0];
  16. if (userAnswers[0] == 'a' || userAnswers[0] == 'b' || userAnswers[0] == 'c') {
  17. if (userAnswers[0] == answers[0]) {
  18. cout << "Correct!\n\n";
  19. score++;
  20. } else {
  21. cout << "Wrong!\n\n";
  22. }
  23. } else {
  24. cout << "Invalid Answer!\n\n";
  25. }
  26.  
  27. cout << "2. Which event marked the start of the Philippine Revolution against Spain?\n";
  28. cout << " a) The Cry of Pugad Lawin\n b) The Battle of Mactan\n c) The Pact of Biak-na-Bato\n";
  29. cout << "Your Answer: ";
  30. cin >> userAnswers[1];
  31. if (userAnswers[1] == 'a' || userAnswers[1] == 'b' || userAnswers[1] == 'c') {
  32. if (userAnswers[1] == answers[1]) {
  33. cout << "Correct!\n\n";
  34. score++;
  35. } else {
  36. cout << "Wrong!\n\n";
  37. }
  38. } else {
  39. cout << "Invalid Answer!\n\n";
  40. }
  41.  
  42. cout << "3. Who is known as the national hero of the Philippines?\n";
  43. cout << " a) Andres Bonifacio\n b) José Rizal\n c) Apolinario Mabini\n";
  44. cout << "Your Answer: ";
  45. cin >> userAnswers[2];
  46. if (userAnswers[2] == 'a' || userAnswers[2] == 'b' || userAnswers[2] == 'c') {
  47. if (userAnswers[2] == answers[2]) {
  48. cout << "Correct!\n\n";
  49. score++;
  50. } else {
  51. cout << "Wrong!\n\n";
  52. }
  53. } else {
  54. cout << "Invalid Answer!\n\n";
  55. }
  56.  
  57. cout << "4. What was the name of the treaty that ended the Spanish-American War and led to the cession of the Philippines to the United States?\n";
  58. cout << " a) Treaty of Versailles\n b) Treaty of Paris (1898)\n c) Treaty of Tordesillas\n";
  59. cout << "Your Answer: ";
  60. cin >> userAnswers[3];
  61. if (userAnswers[3] == 'a' || userAnswers[3] == 'b' || userAnswers[3] == 'c') {
  62. if (userAnswers[3] == answers[3]) {
  63. cout << "Correct!\n\n";
  64. score++;
  65. } else {
  66. cout << "Wrong!\n\n";
  67. }
  68. } else {
  69. cout << "Invalid Answer!\n\n";
  70. }
  71.  
  72. cout << "5. Which city was the capital of the Philippines during the Japanese occupation in World War II?\n";
  73. cout << " a) Cebu\n b) Davao\n c) Manila\n";
  74. cout << "Your Answer: ";
  75. cin >> userAnswers[4];
  76. if (userAnswers[4] == 'a' || userAnswers[4] == 'b' || userAnswers[4] == 'c') {
  77. if (userAnswers[4] == answers[4]) {
  78. cout << "Correct!\n\n";
  79. score++;
  80. } else {
  81. cout << "Wrong!\n\n";
  82. }
  83. } else {
  84. cout << "Invalid Answer!\n\n";
  85. }
  86. int percentage = score * 20;
  87. cout << "\nYour Score: " << score << "/5" << endl;
  88. cout << "Grade: " << percentage << "%" << endl;
  89. cout << "Remarks: ";
  90. if (score == 5) {
  91. cout << "Excellent" << endl;
  92. } else if (score == 4) {
  93. cout << "Satisfactory" << endl;
  94. } else if (score == 3) {
  95. cout << "Very Good" << endl;
  96. } else if (score == 2) {
  97. cout << "Good" << endl;
  98. } else if (score == 1) {
  99. cout << "Fair" << endl;
  100. } else {
  101. cout << "Failed" << endl;
  102. }
  103. return 0;
  104. }
Success #stdin #stdout 0.01s 5276KB
stdin
7
0
662573
10000
18898541
32385559
4
6
stdout
Philippine History Quiz

Multiple Choice Only

1. Who was the first President of the Philippines?
   a) Emilio Aguinaldo
   b) Manuel L. Quezon
   c) José P. Laurel
Your Answer: Invalid Answer!

2. Which event marked the start of the Philippine Revolution against Spain?
   a) The Cry of Pugad Lawin
   b) The Battle of Mactan
   c) The Pact of Biak-na-Bato
Your Answer: Invalid Answer!

3. Who is known as the national hero of the Philippines?
   a) Andres Bonifacio
   b) José Rizal
   c) Apolinario Mabini
Your Answer: Invalid Answer!

4. What was the name of the treaty that ended the Spanish-American War and led to the cession of the Philippines to the United States?
   a) Treaty of Versailles
   b) Treaty of Paris (1898)
   c) Treaty of Tordesillas
Your Answer: Invalid Answer!

5. Which city was the capital of the Philippines during the Japanese occupation in World War II?
   a) Cebu
   b) Davao
   c) Manila
Your Answer: Invalid Answer!


Your Score: 0/5
Grade: 0%
Remarks: Failed