Advertisement
UnlimitedSupply

Easy quiz maker

Jun 19th, 2022
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <unistd.h>
  4. using namespace std;
  5. int CurrentQuestion, Done, Correct;
  6. string answered, ready;
  7.  
  8.  
  9. vector<string> answers {
  10.     "A",
  11.     "C"
  12. };
  13.  
  14.  
  15. vector<string> Questions {
  16.     "Which statement is correct?",
  17.     "What is an IF statement?"
  18. };
  19.  
  20.  
  21. vector<string> Aes {
  22.     "C++ is hard.",
  23.     "An IF statement is a checker."
  24. };
  25.  
  26.  
  27. vector<string> Bes {
  28.     "C++ is easy.",
  29.     "An IF statement is a variable that sees if a statement is true."
  30. };
  31.  
  32.  
  33. vector<string> Ces {
  34.     "C++ is C#.",
  35.     "A and B."
  36. };
  37.  
  38.  
  39. vector<string> Des {
  40.     "C# is easier than Lua.",
  41.     "None of the above."
  42. };
  43.  
  44. bool CheckForGlitches() {
  45.     for (int wowsers = 0; wowsers < answers.size(); wowsers++) {
  46.         if (answers[wowsers] != "A" && answers[wowsers] != "B" && answers[wowsers] != "C" && answers[wowsers] != "D") {
  47.             cout << "There is a glitch in the answers for question " << wowsers + 1 << ".\n";
  48.             cout << "Please report it to the nearest teacher to look at the answers.";
  49.             return true;
  50.         }
  51.         if (answers.size() != Aes.size() || Aes.size() != Bes.size() || Bes.size() != Ces.size() || Ces.size() != Des.size()) {
  52.             cout << "There is a glitch by one of the teachers, one of the vector sizes \n (or known as how many answers there are) are shorter than the other\n";
  53.             cout << "to fix this, please look at how many lines of code the Aes, Bes, Ces, Des, and if your a teacher, the answers vector.";
  54.             return true;
  55.         }
  56.     }
  57. }
  58.  
  59. int main() {
  60.     if (CheckForGlitches() == true) {
  61.         sleep(1);
  62.         cout << " ";
  63.         sleep(9999);
  64.     }
  65.     do {
  66.         cout << "are you a teacher, student, or testor?\n";
  67.         cout << "I am a ";
  68.         cin >> answered;
  69.     } while (answered != "teacher" && answered != "student" && answered != "testor");
  70.     if (answered == "teacher") {
  71.         cout << "Enter code: ";
  72.         cin >> answered;
  73.         if (answered == "5621") {
  74.             for (int PewPew = 0; PewPew < answers.size(); PewPew++) {
  75.                 cout << "Answer for question " << PewPew + 1 << " is: " << answers[PewPew] << "\n";
  76.             }
  77.         }
  78.     } else if (answered == "student") {
  79.         do {
  80.             cout << "Enter E when your ready!\n";
  81.             cin >> ready;
  82.         } while (ready != "E" && ready != "e");
  83.         for (int x = 0; x < answers.size(); x++) {
  84.             do {
  85.                 for (int p = 40; p >= 0; p--) {
  86.                     cout << "\n";
  87.                 }
  88.                 CurrentQuestion++;
  89.                 cout << "Q" << CurrentQuestion << "\n";
  90.                 cout << "     " << Questions[x] << "\n\n";
  91.                 cout << " A: " << Aes[x] << "\n\n";
  92.                 cout << " B: " << Bes[x] << "\n\n";
  93.                 cout << " C: " << Ces[x] << "\n\n";
  94.                 cout << " D: " << Des[x] << "\n\n";
  95.                 cout << "Answer: ";
  96.                 cin >> answered;
  97.                 if (answered == "a") {
  98.                     answered = "A";
  99.                 } else if (answered == "b") {
  100.                     answered = "B";
  101.                 } else if (answered == "c") {
  102.                     answered = "C";
  103.                 } else if (answered == "d") {
  104.                     answered = "D";
  105.                 }
  106.             } while (answered != "A" && answered != "B" && answered != "C" && answered != "D");
  107.             if (answered == answers[x]) {
  108.                 cout << "Correct!\n";
  109.                 Correct++;
  110.                 sleep(4);
  111.             } else {
  112.                 cout << "Incorrect, the correct answer is: " << answers[x] << "\n";
  113.                 sleep(4);
  114.             }
  115.         }
  116.         cout << "You got: " << Correct << "/" << answers.size() << "\n";
  117.         if (Correct == answers.size()) {
  118.             cout << "Perfect score!\n";
  119.             sleep(3);
  120.         }
  121.     } else {
  122.         cout << "Put in the code.\n";
  123.         cout << "Input: ";
  124.         cin >> answered;
  125.         if (answered == ".-. .. -.-. -.- / .-. --- .-.. .-.. . -.. 61 6e 64 20 70 65 61 73 20 70 6c 65 61 73 65") {
  126.             do {
  127.                 cout << "Hello testor, what do you want to see?\n";
  128.                 cout << "  A: answers\n";
  129.                 cout << "  B: Aes, Bes, Ces, Des\n";
  130.                 cout << "  C: quiz itself\n";
  131.                 cout << "  D: cute cat.\n";
  132.                 cout << "  E: terminate.\n";
  133.                 cout << "Input: ";
  134.                 cin >> answered;
  135.                 if (answered == "A" || answered == "a") {
  136.                     for (int PewPew = 0; PewPew < answers.size(); PewPew++) {
  137.                         cout << "Answer for question " << PewPew + 1 << " is: " << answers[PewPew] << "\n";
  138.                     }
  139.                     cin >> answered;
  140.                 } else if (answered == "B" || answered == "b") {
  141.                     "Aes:\n";
  142.                     for (int PewPew = 0; PewPew < Aes.size(); PewPew++) {
  143.                         cout << "Answer for question " << PewPew + 1 << " is: " << Aes[PewPew] << "\n";
  144.                     }
  145.                     cout << "\n";
  146.                     "Bes:\n";
  147.                     for (int PewPew = 0; PewPew < Bes.size(); PewPew++) {
  148.                         cout << "Answer for question " << PewPew + 1 << " is: " << Bes[PewPew] << "\n";
  149.                     }
  150.                     cout << "\n";
  151.                     "Ces:\n";
  152.                     for (int PewPew = 0; PewPew < Ces.size(); PewPew++) {
  153.                         cout << "Answer for question " << PewPew + 1 << " is: " << Ces[PewPew] << "\n";
  154.                     }
  155.                     cout << "\n";
  156.                     "Des:\n";
  157.                     for (int PewPew = 0; PewPew < Des.size(); PewPew++) {
  158.                         cout << "Answer for question " << PewPew + 1 << " is: " << Des[PewPew] << "\n";
  159.                     }
  160.                     cout << "\n";
  161.                     cin >> answered;
  162.                 } else if (answered == "C" || answered == "c") {
  163.                     cout << "You cant answer by the way. enter anything when your ready.\n";
  164.                     cin >> answered;
  165.                     for (int x = 0; x < answers.size(); x++) {
  166.                         for (int p = 40; p >= 0; p--) {
  167.                             cout << "\n";
  168.                         }
  169.                         CurrentQuestion++;
  170.                         cout << "Q" << CurrentQuestion << "\n";
  171.                         cout << "     " << Questions[x] << "\n\n";
  172.                         cout << " A: " << Aes[x] << "\n\n";
  173.                         cout << " B: " << Bes[x] << "\n\n";
  174.                         cout << " C: " << Ces[x] << "\n\n";
  175.                         cout << " D: " << Des[x] << "\n\n";
  176.                         cout << "Answer: ";
  177.                         cin >> answered;
  178.                     }
  179.                 } else if (answered == "D" || answered == "d") {
  180.                     cout << "https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab";
  181.                     cin >> answered;
  182.                     cout << "you really just got rick rolled didnt you?\n";
  183.                     sleep(3);
  184.                     cout << "cmon, the real testors would know that D stands for rick rolleD! :) \n";
  185.                     sleep(3);
  186.                 }
  187.             } while (answered != "E" || answered != "e");
  188.             cout << "goodbye testor.\n";
  189.         } else {
  190.             cout << "Wrong code, if you feel like this is wrong, go to: https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab\n";
  191.             cout << "For more information.\n";
  192.         }
  193.     }
  194. }
  195.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement