1. #include <iostream>
  2. #include <fstream>
  3. #include <cstdlib>
  4. #include <ctime>
  5. #include <string>
  6. using namespace std;
  7.  
  8. int getWhatTheyWant();
  9. void displayItems(int x);
  10.  
  11. //main function
  12. int main(){
  13.  
  14.     int whatTheyWant;
  15.  
  16.     whatTheyWant = getWhatTheyWant();
  17.  
  18.     while(whatTheyWant != 0){
  19.         switch(whatTheyWant){
  20.             case 1:
  21.                 displayItems(1);
  22.                 break;
  23.             case 2:
  24.                 displayItems(2);
  25.                 break;
  26.             case 3:
  27.                 displayItems(3);
  28.                 break;
  29.             case 4:
  30.                 displayItems(4);
  31.                 break;
  32.             case 5:
  33.                 displayItems(5);
  34.                 break;
  35.             case 6:
  36.                 displayItems(6);
  37.                 break;
  38.             case 7:
  39.                 displayItems(7);
  40.                 break;
  41.             case 8:
  42.                 displayItems(8);
  43.                 break;
  44.             case 9:
  45.                 displayItems(9);
  46.                 break;
  47.             case 10:
  48.                 displayItems(10);
  49.                 break;
  50.             case 11:
  51.                 displayItems(11);
  52.                 break;
  53.             case 12:
  54.                 displayItems(12);
  55.                 break;
  56.             case 13:
  57.                 displayItems(13);
  58.                 break;
  59.             case 14:
  60.                 displayItems(14);
  61.                 break;
  62.             case 15:
  63.                 displayItems(15);
  64.                 break;
  65.             case 16:
  66.                 displayItems(16);
  67.                 break;
  68.             case 17:
  69.                 displayItems(17);
  70.                 break;
  71.             case 18:
  72.                 displayItems(18);
  73.                 break;
  74.  
  75.         }
  76.  
  77.         whatTheyWant = getWhatTheyWant();
  78.     }
  79.  
  80. }
  81.  
  82. //what they want function
  83. int getWhatTheyWant(){
  84.     int choice;
  85.  
  86.     cout << "Press 1 to add numbers" << endl;
  87.     cout << "" << endl;
  88.     cout << "Press 2 to subtract numbers" << endl;
  89.     cout << "" << endl;
  90.     cout << "Press 3 to multiply numbers" << endl;
  91.     cout << "" << endl;
  92.     cout << "Press 4 to divide numbers" << endl;
  93.     cout << "" << endl;
  94.     cout << "Press 5 to work out a square number" << endl;
  95.     cout << "" << endl;
  96.     cout << "Press 6 to work out a cube number" << endl;
  97.     cout << "" << endl;
  98.     cout << "Press 7 to work out a 4th root" << endl;
  99.     cout << "" << endl;
  100.     cout << "Press 8 to enter the random number menu" << endl;
  101.     cout << "" << endl;
  102.     cout << "Press 9 to do a quiz" << endl;
  103.     cout << "" << endl;
  104.     cout << "Press 10 for a celcius to farenheit converter" << endl;
  105.     cout << "" << endl;
  106.     cout << "Press 11 for a farenheit to celcius converter" << endl;
  107.     cout << "" << endl;
  108.     cout << "Press 0 to quit program" << endl;
  109.     cout << "" << endl;
  110.  
  111.     cin >> choice;
  112.     cout << "" << endl;
  113.     return choice;
  114.  
  115. }
  116.  
  117. //display items funcitons
  118. void displayItems(int x){
  119.  
  120.     int Q1;
  121.     int Q2;
  122.     int Q3;
  123.     int Q4;
  124.     int Q5;
  125.     int ans1 = 411;
  126.     int ans2 = 93;
  127.     int ans3 = 180;
  128.     int ans4 = 789;
  129.     int ans5 = 6;
  130.     int score = 0;
  131.     int a;
  132.     int b;
  133.     double sum;
  134.     double sum1;
  135.     int y; //rand
  136.     int d; //rand
  137.     int k; //rand
  138.     double celc; //Celc converter farenheit
  139.     double faren; //farenheit
  140.     string u;
  141.  
  142.     if(x==1){ //add
  143.             cout << "Which numbers do you want to add?" << endl;
  144.         cout << "" << endl;
  145.         cout << "Enter first number!" << endl;
  146.         cout << "" << endl;
  147.         cin >> a;
  148.         cout << "" << endl;
  149.         cout << "Enter the second number!" << endl;
  150.         cout << "" << endl;
  151.         cin >> b;
  152.         cout << "" << endl;
  153.         sum = (a + b);
  154.         cout << "The sum of your numbers is " << sum << endl;
  155.         cout << "" << endl;
  156.     }
  157.  
  158.     if(x==2){ //subtract
  159.            cout << "Which numbers do you want to subtract?" << endl;
  160.         cout << "" << endl;
  161.         cout << "Enter first number!" << endl;
  162.         cout << "" << endl;
  163.         cin >> a;
  164.         cout << "" << endl;
  165.         cout << "Enter the second number!" << endl;
  166.         cout << "" << endl;
  167.         cin >> b;
  168.         cout << "" << endl;
  169.         sum = (a - b);
  170.         cout << "The answer is " << sum << endl;
  171.         cout << "" << endl;
  172.     }
  173.  
  174.     if(x==3){ //multiply
  175.             cout << "Which numbers do you want to multiply together?" << endl;
  176.         cout << "" << endl;
  177.         cout << "Enter first number!" << endl;
  178.         cout << "" << endl;
  179.         cin >> a;
  180.         cout << "" << endl;
  181.         cout << "Enter the second number!" << endl;
  182.         cout << "" << endl;
  183.         cin >> b;
  184.         cout << "" << endl;
  185.         sum = (a * b);
  186.         cout << "The answer is " << sum << endl;
  187.         cout << "" << endl;
  188.     }
  189.  
  190.     if(x==4){ //divide
  191.             cout << "Which numbers do you want to divide?" << endl;
  192.         cout << "" << endl;
  193.         cout << "Enter first number!" << endl;
  194.         cout << "" << endl;
  195.         cin >> a;
  196.         cout << "" << endl;
  197.         cout << "Enter the second number!" << endl;
  198.         cout << "" << endl;
  199.         cin >> b;
  200.         cout << "" << endl;
  201.         sum = (a / b);
  202.         cout << "The answer is " << sum << endl;
  203.         cout << "" << endl;
  204.     }
  205.  
  206.     if(x==5){ //squares
  207.             cout << "Which number do you want to turn into a square number?" << endl;
  208.        cout << "" << endl;
  209.        cout << "Enter the number!" << endl;
  210.        cout << "" << endl;
  211.        cin >> a;
  212.        cout << "" << endl;
  213.        sum = (a * a);
  214.        cout << "The answer is " << sum << endl;
  215.        cout << "" << endl;
  216.     }
  217.  
  218.     if(x==6){ //cubes
  219.             cout << "Which number do you want to turn into a cube number?" << endl;
  220.        cout << "" << endl;
  221.        cout << "Enter the number!" << endl;
  222.        cout << "" << endl;
  223.        cin >> a;
  224.        cout << "" << endl;
  225.        sum = (a * a * a);
  226.        cout << "The answer is " << sum << endl;
  227.        cout << "" << endl;
  228.     }
  229.  
  230.     if(x==7){ //4th root
  231.             cout << "Which number do you want to turn into a 4th root?" << endl;
  232.        cout << "" << endl;
  233.        cout << "Enter the number!" << endl;
  234.        cout << "" << endl;
  235.        cin >> a;
  236.        cout << "" << endl;
  237.        sum = (a * a * a * a);
  238.        cout << "The answer is " << sum << endl;
  239.        cout << "" << endl;
  240.         }
  241.  
  242.     if(x==8){ //random
  243.         cout << "Welcome to the random number genarator menu!" << endl;
  244.         cout << "" << endl;
  245.         cout << "Enter how many numbers you want to be generated" << endl;
  246.         cout << "" << endl;
  247.         cin >> y;
  248.         cout << "" << endl;
  249.         cout << "Enter the minimum value" << endl;
  250.         cout << "" << endl;
  251.         cin >> d;
  252.         cout << "" << endl;
  253.         cout << "Enter the maximum value" << endl;
  254.         cin >> k;
  255.         cout << "" << endl;
  256.  
  257.         srand(time(0));
  258.  
  259.         for(int x = 1; x<y+1;x++){
  260.         cout << d+(rand()%k) << endl;
  261.         }
  262.         cout << "" << endl;
  263.     }
  264.  
  265.     if(x==9){ //Quiz
  266.         cout << "Type 'one' for the quiz" << endl;
  267.         cout << "" << endl;
  268.         cin >> u;
  269.         cout << "" << endl;
  270.         if(u=="one"){
  271.             cout << "What is 284 + 127? \n"; //question 1 starts
  272.     cin >> Q1;
  273.     cout << " " << endl;
  274.  
  275.     if (Q1 == ans1){
  276.         cout << "Well done, the answer was indeed 411" << endl;
  277.  
  278.         cout << "" << endl;
  279.  
  280.     score++;
  281.  
  282.     }else{
  283.         cout << "Nope, the answer was not " << Q1 << " but was 411" << endl;
  284.  
  285.         cout << "" << endl;
  286.  
  287.     score += 0;
  288.  
  289.         }
  290.  
  291.     cout << "  \n";
  292.     cout << "If X = 7 then what is Y when Y = X^2 + 44?" << endl;
  293.     cin >> Q2;
  294.     cout << " " << endl;
  295.  
  296.     if (Q2 == ans2){
  297.         cout << "Well done, the answer was indeed " << ans2 << endl;
  298.  
  299.         cout << "" << endl;
  300.  
  301.     score++;
  302.  
  303.     }else{
  304.         cout << "Nope, the answer was not " << Q2 << " but was 93" << endl;
  305.  
  306.         cout << "" << endl;
  307.  
  308.     score += 0;
  309.  
  310.         }
  311.  
  312.             cout << "  \n";
  313.     cout << "Work out X in this equation: 5x + 100 = 1000" << endl;
  314.     cin >> Q3;
  315.     cout << " " << endl;
  316.  
  317.     if (Q3 == ans3){
  318.         cout << "Well done, the answer was indeed 180" << endl;
  319.  
  320.         cout << "" << endl;
  321.  
  322.     score++;
  323.  
  324.     }else{
  325.         cout << "Nope, the answer was not " << Q3 << " but was 180" << endl;
  326.  
  327.         cout << "" << endl;
  328.  
  329.     score += 0;
  330.  
  331.         }
  332.  
  333.                     cout << "  \n";
  334.     cout << "What number does DCCLXXXIX mean?" << endl;
  335.     cin >> Q4;
  336.     cout << " " << endl;
  337.  
  338.     if (Q4 == ans4){
  339.         cout << "Well done, the answer was indeed 789" << endl;
  340.  
  341.         cout << "" << endl;
  342.  
  343.     score++;
  344.  
  345.     }else{
  346.         cout << "Nope, the answer was not " << Q4 << " but was 789" << endl;
  347.  
  348.         cout << "" << endl;
  349.  
  350.     score += 0;
  351.  
  352.         }
  353.  
  354.                     cout << "  \n";
  355.     cout << "When P = 13.5 and F = 9: What does E equal when P*E = F^2" << endl;
  356.     cin >> Q5;
  357.     cout << " " << endl;
  358.  
  359.     if (Q5 == ans5){
  360.         cout << "Well done, the answer was indeed 6" << endl;
  361.  
  362.         cout << "" << endl;
  363.  
  364.     score++;
  365.  
  366.     }else{
  367.         cout << "Nope, the answer was not " << Q5 << " but was 6" << endl;
  368.  
  369.         cout << "" << endl;
  370.  
  371.     score += 0;
  372.  
  373.         }
  374.  
  375.     cout << "your final score is... " << score << "/5" << endl;
  376.     cout << " " << endl;
  377.  
  378.         switch(score){
  379.             case 5:
  380.                 cout << " " << endl;
  381.                 cout << "Amazing, 5/5 is pretty tough!" << endl;
  382.                 cout << " " << endl;
  383.             break;
  384.             case 4:
  385.                 cout << " " << endl;
  386.                 cout << "Pretty good, 4/5 is a good feat!" << endl;
  387.                 cout << " " << endl;
  388.             break;
  389.             case 3:
  390.                 cout << " " << endl;
  391.                 cout << "okay, 3/5 is an okay score" << endl;
  392.                 cout << " " << endl;
  393.             break;
  394.             case 2:
  395.                 cout << " " << endl;
  396.                 cout << "Good... ish , 2/5 isn't hard to do" << endl;
  397.                 cout << " " << endl;
  398.             break;
  399.             case 1:
  400.                 cout << " " << endl;
  401.                 cout << "This is bad, 1/5 is pretty bad" << endl;
  402.                 cout << " " << endl;
  403.             break;
  404.             case 0:
  405.                 cout << " " << endl;
  406.                 cout << "What, are you 3? 0/5 is unacceptable" << endl;
  407.                 cout << " " << endl;
  408.  
  409.         }
  410.  
  411.     }
  412.  
  413.  
  414.     }
  415.  
  416.     if(x==10){ //Celc to faren
  417.         cout << "Welcome to the celcuis to farenheit converter!" << endl;
  418.         cout << "" << endl;
  419.         cout << "Enter celcuis: " << endl;
  420.         cout << "" << endl;
  421.         cin >> celc;
  422.         cout << "" << endl;
  423.         sum = (celc * 1.8);
  424.         sum1 = (sum + 32);
  425.         cout << celc << " celcius is " << sum1 << " farenheit" << endl;
  426.         cout << "" << endl;
  427.     }
  428.  
  429.     if(x==11){
  430.         cout << "Welcome to the farenheit to celcius converter!" << endl;
  431.         cout << "" << endl;
  432.         cout << "Enter farenheit" << endl;
  433.         cin >> faren;
  434.         cout << "" << endl;
  435.         sum = (faren - 32);
  436.         sum1 = (sum / 1.8);
  437.         cout << faren << " farenheit is " << sum1 << " celcuis" << endl;
  438.         cout << "" << endl;
  439.     }
  440.  
  441.     if(x==12){
  442.         int score = 0;
  443.         int qe1;
  444.         int qe2;
  445.         int qe3;
  446.         int qe4;
  447.         int qe5;
  448.         int qe6;
  449.         int qwe1 = 1;
  450.         int qwe2 = 2;
  451.         int qwe3 = 3;
  452.         int qwe4 = 4;
  453.         int qwe5 = 5;
  454.         int qwe6 = 6;
  455.  
  456.         cin >> qe1;
  457.         cin >> qe2;
  458.         cin >> qe3;
  459.         cin >> qe4;
  460.         cin >> qe5;
  461.         cin >> qe6;
  462.  
  463.         if(qe1 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
  464.             score = score + 10;
  465.         }else{
  466.  
  467.         }
  468.         if(qe2 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
  469.             score = score + 10;
  470.         }else{
  471.  
  472.         }
  473.         if(qe3 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
  474.             score = score + 10;
  475.         }else{
  476.  
  477.         }
  478.         if(qe4 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
  479.             score = score + 10;
  480.         }else{
  481.  
  482.         }
  483.         if(qe5 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
  484.             score = score + 10;
  485.         }else{
  486.  
  487.         }
  488.         if(qe6 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
  489.             score = score + 10;
  490.         }else{
  491.  
  492.         }
  493.         cout << "" << endl;
  494.         cout << score << endl;
  495.  
  496.     }
  497.  
  498. }