Guest User

Help with math?

a guest
Apr 22nd, 2012
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 10.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string start = "";
  9.  
  10.     int score;
  11.     int percent;
  12.  
  13.     cout << "Type 'Go' to begin the quiz, 'Help' for instructions, or 'Exit' to quit\n" << endl;
  14.     cin >> start;
  15.     cout << "\n" << endl;
  16.  
  17.     if (start == "exit")
  18.     {
  19.         cout << "Thanks for taking the quiz! Press Enter to exit\n";
  20.  
  21.         cin.ignore();
  22.         cin.get();
  23.         return 0;
  24.     }
  25.  
  26.     if (start == "help")
  27.     {
  28.         cout << "All questions require a number as an answer. Some questions ask for a one-digit answer, "
  29.              << "and others a two-digit number. An example of a question that requires a one-digit number "
  30.              << "as an answer could be: 1 = What colour is grass. In this case, you would type '1' to choose "
  31.              << "this answer. Here is an example of a possible answer of a question which requires a two-"
  32.              << "digit number as an answer: 74. Notice that there is no '=' or words, but just a number, "
  33.              << "unlike a question that asks for a one-digit number as an answer" << endl;
  34.         cout << "\n" << endl;
  35.     }
  36.  
  37.     if (start == "go")
  38.     {
  39.  
  40.     }
  41.     {
  42.  
  43.         string q1 = "";
  44.  
  45.         score = 0;
  46.  
  47.         cout << "Question 1/16:\nWhat is Effie Trinket's favourite quote?\n\n1 = 'Let the odds be in your favour'\n"
  48.              << "2 = 'Shall the odds be ever in your favour'\n3 = 'May the odds be ever in your favour'\n4 ="
  49.              << " 'May the odds last forever in your favour'\n" << endl;
  50.         cin >> q1;
  51.         cout << "\n" << endl;
  52.  
  53.         if (q1 == "3")
  54.             score = score + 1;
  55.  
  56.  
  57.         if (q1 == "exit")
  58.         {
  59.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  60.             cin.ignore();
  61.             cin.get();
  62.             return 0;
  63.         }
  64.         string q2 = "";
  65.         cout << "Question 2/16:\nWhat district are Cato and Clove from?\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n"
  66.              << "11\n12\n" << endl;
  67.         cin >> q2;
  68.         cout << "\n" << endl;
  69.  
  70.         if (q2 == "2")
  71.         {
  72.             score = score + 1;
  73.         }
  74.  
  75.         if (q2 == "exit")
  76.         {
  77.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  78.             cin.ignore();
  79.             cin.get();
  80.             return 0;
  81.         }
  82.         string q3 = "";
  83.         cout << "Question 3/16:\nHow many tributes are chosen each year to participate in the Hunger Games?\n\n"
  84.              << "2\n4\n6\n8\n10\n12\n14\n16\n18\n20\n22\n24\n26\n28\n30\n" << endl;
  85.         cin >> q3;
  86.         cout << "\n" << endl;
  87.  
  88.         if (q3 == "24")
  89.         {
  90.             score = score + 1;
  91.         }
  92.  
  93.         if (q3 == "exit")
  94.         {
  95.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  96.             cin.ignore();
  97.             cin.get();
  98.             return 0;
  99.         }
  100.         string q4 = "";
  101.         cout << "Question 4/16:\nWho is the first tribute Katniss kills directly?\n\n1 = Marvel\n2 = Glimmer\n"
  102.              << "3 = Cato\n4 = Clove\n5 = Foxface\n6 = Thresh\n7 = Rue\n" << endl;
  103.         cin >> q4;
  104.         cout << "\n" << endl;
  105.  
  106.         if (q4 == "1")
  107.         {
  108.             score = score + 1;
  109.         }
  110.  
  111.         if (q4 == "exit")
  112.         {
  113.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  114.             cin.ignore();
  115.             cin.get();
  116.             return 0;
  117.         }
  118.         string q5 = "";
  119.         cout << "Question 5/16:\nWhat is Prim's cat's name?\n\n1 = Furball\n2 = Honeyball\n3 = Buttercup\n4 = Lady"
  120.              << "\n5 = Butterball\n" << endl;
  121.         cin >> q5;
  122.         cout << "\n" << endl;
  123.  
  124.         if (q5 == "3")
  125.         {
  126.             score = score + 1;
  127.         }
  128.  
  129.         if (q5 == "exit")
  130.         {
  131.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  132.             cin.ignore();
  133.             cin.get();
  134.             return 0;
  135.         }
  136.         string q6 = "";
  137.         cout << "Question 6/16:\nHow old was Katniss when she volunteered as tribute?\n\n12\n13\n14\n15\n16\n17\n"
  138.              << "18\n" << endl;
  139.         cin >> q6;
  140.         cout << "\n" << endl;
  141.  
  142.         if (q6 == "16")
  143.         {
  144.             score = score + 1;
  145.         }
  146.  
  147.         if (q6 == "exit")
  148.         {
  149.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  150.             cin.ignore();
  151.             cin.get();
  152.             return 0;
  153.         }
  154.         string q7 = "";
  155.         cout << "Question 7/16:\nWhat is Gale's hunting specialty?\n\n1 = Gun\n2 = Bow & Arrow\n3 = Snares\n4 = "
  156.              << "Machete\n" << endl;
  157.         cin >> q7;
  158.         cout << "\n" << endl;
  159.  
  160.         if (q7 == "3")
  161.         {
  162.             score = score + 1;
  163.         }
  164.  
  165.         if (q7 == "exit")
  166.         {
  167.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  168.             cin.ignore();
  169.             cin.get();
  170.             return 0;
  171.         }
  172.         string q8 = "";
  173.         cout << "Question 8/16:\nEvery how many years does a Quarter Quell take place?\n\n5\n10\n15\n20\n25\n30\n35\n"
  174.              << "40\n45\n50\n55\n" << endl;
  175.         cin >> q8;
  176.         cout << "\n" << endl;
  177.  
  178.         if (q8 == "25")
  179.         {
  180.             score = score + 1;
  181.         }
  182.  
  183.         if (q8 == "exit")
  184.         {
  185.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  186.             cin.ignore();
  187.             cin.get();
  188.             return 0;
  189.         }
  190.         string q9 = "";
  191.         cout << "Question 9/16:\nWhich Hunger Games did Haymitch win? Was it a Quarter Quell?\n\n1 = 34th, No\n2 = 34th"
  192.              << ", Yes\n3 = 48th, No\n4 = 48th, Yes\n5 = 50th, Yes\n6 = 50th, No\n7 = 52nd, No\n8 = 52nd, Yes\n9 = 54"
  193.              << "th, No\n10 = 54th, Yes\n" << endl;
  194.         cin >> q9;
  195.         cout << "\n" << endl;
  196.  
  197.         if (q9 == "5")
  198.         {
  199.             score = score + 1;
  200.         }
  201.  
  202.         if (q9 == "exit")
  203.         {
  204.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  205.             cin.ignore();
  206.             cin.get();
  207.             return 0;
  208.         }
  209.         string q10 = "";
  210.         cout << "Question 10/16:\nWhat is Gale's sister's name?\n\n1 = Victoria\n2 = Lily\n3 = Posy\n4 = Emily\n" << endl;
  211.         cin >> q10;
  212.         cout << "\n" << endl;
  213.  
  214.         if (q10 == "3")
  215.         {
  216.             score = score + 1;
  217.         }
  218.  
  219.         if (q10 == "exit")
  220.         {
  221.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  222.             cin.ignore();
  223.             cin.get();
  224.             return 0;
  225.         }
  226.         string q11 = "";
  227.         cout << "Question 11/16:\nWho was Katniss's first ally in the Games?\n\n1 = Cato\n2 = Clove\n"
  228.              << "3 = Marvel\n4 = Thresh\n5 = Rue\n6 = Glimmer\n7 = Foxface\n8 = Peeta\n" << endl;
  229.         cin >> q11;
  230.         cout << "\n" << endl;
  231.  
  232.         if (q11 == "5")
  233.         {
  234.             score = score + 1;
  235.         }
  236.  
  237.         if (q11 == "exit")
  238.         {
  239.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  240.             cin.ignore();
  241.             cin.get();
  242.             return 0;
  243.         }
  244.         string q12 = "";
  245.         cout << "Question 12/16:\nWho did Katniss kill with the tracker jackers?\n\n1 = Peeta\n2 = Marvel\n3 = Clove\n"
  246.              << "4 = Thresh\n5 = Cato\n6 = Rue\n7 = Foxface\n8 = Glimmer\n" << endl;
  247.         cin >> q12;
  248.         cout << "\n" << endl;
  249.  
  250.         if (q12 == "8")
  251.         {
  252.             score = score + 1;
  253.         }
  254.  
  255.         if (q12 == "exit")
  256.         {
  257.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  258.             cin.ignore();
  259.             cin.get();
  260.             return 0;
  261.         }
  262.  
  263.         string q13 = "";
  264.         cout << "Question 13/16:\nWho is the host for the Hunger Games?\n\n1 = Finnick Odair\n2 = Cinna\n"
  265.              << "3 = Caesar Flickerman\n4 = Plutarch Heavensbee\n5 = Seneca Crane\n" << endl;
  266.         cin >> q13;
  267.         cout << "\n" << endl;
  268.  
  269.         if (q13 == "3")
  270.         {
  271.             score = score + 1;
  272.         }
  273.  
  274.         if (q13 == "exit")
  275.         {
  276.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  277.             cin.ignore();
  278.             cin.get();
  279.             return 0;
  280.         }
  281.         string q14 = "";
  282.         cout << "Question 14/16:\nWhat is the name of Prim's goat?\n\n1 = Lady\n2 = Ivy\n3 = Buttercup\n"
  283.              << "4 = Glimmer\n5 = Midnight\n6 = Rose\n7 = Mint\n" << endl;
  284.         cin >> q14;
  285.         cout << "\n" << endl;
  286.  
  287.         if (q14 == "1")
  288.         {
  289.             score = score + 1;
  290.         }
  291.  
  292.         if (q14 == "exit")
  293.         {
  294.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  295.             cin.ignore();
  296.             cin.get();
  297.             return 0;
  298.         }
  299.         string q15 = "";
  300.         cout << "Question 15/16:\nWhat is the name of Peeta's stylist?\n\n1 = Plutarch\n2 = Cinna\n3 = Effie\n"
  301.              << "4 = Portia\n5 = Haymitch\n6 = Octavia\n7 = Flavius\n" <<endl ;
  302.         cin >> q15;
  303.         cout << "\n" << endl;
  304.  
  305.         if (q15 == "4")
  306.         {
  307.             score = score + 1;
  308.         }
  309.  
  310.         if (q15 == "exit")
  311.         {
  312.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  313.             cin.ignore();
  314.             cin.get();
  315.             return 0;
  316.         }
  317.  
  318.         string q16 = "";
  319.         cout << "Question 16/16:\nWhat is the name of the third book in the Hunger Games trilogy?\n\n"
  320.              << "1 = Mockingbird\n2 = Catching Fire\n3 = Victors Village\n4 = Mockingjay\n5 = Rebellion"
  321.              << "\n6 = Hasn't been released yet\n" <<endl;
  322.         cin >> q15;
  323.         cout << "\n" << endl;
  324.  
  325.         if (q16 == "4")
  326.         {
  327.             score = score + 1;
  328.         }
  329.  
  330.         if (q16 == "exit")
  331.         {
  332.             cout << "Thanks for taking the quiz! Press Enter to exit\n";
  333.             cin.ignore();
  334.             cin.get();
  335.             return 0;
  336.         }
  337.  
  338.         percent = score * 100.0 / 16;
  339.  
  340.         if (percent == 100)
  341.             cout << "Congratulations, you got all of the answers right!\n\nPress Enter to exit" << endl;
  342.  
  343.         else
  344.             cout << "You answered " << percent << "% ("<< score<<"/16) of questions correct!\n\nPress Enter to exit" << endl;
  345.  
  346.         cin.ignore();
  347.         cin.get();
  348.         return 0;
  349.     }
  350. }
Advertisement
Add Comment
Please, Sign In to add comment