#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
int getWhatTheyWant();
void displayItems(int x);
//main function
int main(){
int whatTheyWant;
whatTheyWant = getWhatTheyWant();
while(whatTheyWant != 0){
switch(whatTheyWant){
case 1:
displayItems(1);
break;
case 2:
displayItems(2);
break;
case 3:
displayItems(3);
break;
case 4:
displayItems(4);
break;
case 5:
displayItems(5);
break;
case 6:
displayItems(6);
break;
case 7:
displayItems(7);
break;
case 8:
displayItems(8);
break;
case 9:
displayItems(9);
break;
case 10:
displayItems(10);
break;
case 11:
displayItems(11);
break;
case 12:
displayItems(12);
break;
case 13:
displayItems(13);
break;
case 14:
displayItems(14);
break;
case 15:
displayItems(15);
break;
case 16:
displayItems(16);
break;
case 17:
displayItems(17);
break;
case 18:
displayItems(18);
break;
}
whatTheyWant = getWhatTheyWant();
}
}
//what they want function
int getWhatTheyWant(){
int choice;
cout << "Press 1 to add numbers" << endl;
cout << "" << endl;
cout << "Press 2 to subtract numbers" << endl;
cout << "" << endl;
cout << "Press 3 to multiply numbers" << endl;
cout << "" << endl;
cout << "Press 4 to divide numbers" << endl;
cout << "" << endl;
cout << "Press 5 to work out a square number" << endl;
cout << "" << endl;
cout << "Press 6 to work out a cube number" << endl;
cout << "" << endl;
cout << "Press 7 to work out a 4th root" << endl;
cout << "" << endl;
cout << "Press 8 to enter the random number menu" << endl;
cout << "" << endl;
cout << "Press 9 to do a quiz" << endl;
cout << "" << endl;
cout << "Press 10 for a celcius to farenheit converter" << endl;
cout << "" << endl;
cout << "Press 11 for a farenheit to celcius converter" << endl;
cout << "" << endl;
cout << "Press 0 to quit program" << endl;
cout << "" << endl;
cin >> choice;
cout << "" << endl;
return choice;
}
//display items funcitons
void displayItems(int x){
int Q1;
int Q2;
int Q3;
int Q4;
int Q5;
int ans1 = 411;
int ans2 = 93;
int ans3 = 180;
int ans4 = 789;
int ans5 = 6;
int score = 0;
int a;
int b;
double sum;
double sum1;
int y; //rand
int d; //rand
int k; //rand
double celc; //Celc converter farenheit
double faren; //farenheit
string u;
if(x==1){ //add
cout << "Which numbers do you want to add?" << endl;
cout << "" << endl;
cout << "Enter first number!" << endl;
cout << "" << endl;
cin >> a;
cout << "" << endl;
cout << "Enter the second number!" << endl;
cout << "" << endl;
cin >> b;
cout << "" << endl;
sum = (a + b);
cout << "The sum of your numbers is " << sum << endl;
cout << "" << endl;
}
if(x==2){ //subtract
cout << "Which numbers do you want to subtract?" << endl;
cout << "" << endl;
cout << "Enter first number!" << endl;
cout << "" << endl;
cin >> a;
cout << "" << endl;
cout << "Enter the second number!" << endl;
cout << "" << endl;
cin >> b;
cout << "" << endl;
sum = (a - b);
cout << "The answer is " << sum << endl;
cout << "" << endl;
}
if(x==3){ //multiply
cout << "Which numbers do you want to multiply together?" << endl;
cout << "" << endl;
cout << "Enter first number!" << endl;
cout << "" << endl;
cin >> a;
cout << "" << endl;
cout << "Enter the second number!" << endl;
cout << "" << endl;
cin >> b;
cout << "" << endl;
sum = (a * b);
cout << "The answer is " << sum << endl;
cout << "" << endl;
}
if(x==4){ //divide
cout << "Which numbers do you want to divide?" << endl;
cout << "" << endl;
cout << "Enter first number!" << endl;
cout << "" << endl;
cin >> a;
cout << "" << endl;
cout << "Enter the second number!" << endl;
cout << "" << endl;
cin >> b;
cout << "" << endl;
sum = (a / b);
cout << "The answer is " << sum << endl;
cout << "" << endl;
}
if(x==5){ //squares
cout << "Which number do you want to turn into a square number?" << endl;
cout << "" << endl;
cout << "Enter the number!" << endl;
cout << "" << endl;
cin >> a;
cout << "" << endl;
sum = (a * a);
cout << "The answer is " << sum << endl;
cout << "" << endl;
}
if(x==6){ //cubes
cout << "Which number do you want to turn into a cube number?" << endl;
cout << "" << endl;
cout << "Enter the number!" << endl;
cout << "" << endl;
cin >> a;
cout << "" << endl;
sum = (a * a * a);
cout << "The answer is " << sum << endl;
cout << "" << endl;
}
if(x==7){ //4th root
cout << "Which number do you want to turn into a 4th root?" << endl;
cout << "" << endl;
cout << "Enter the number!" << endl;
cout << "" << endl;
cin >> a;
cout << "" << endl;
sum = (a * a * a * a);
cout << "The answer is " << sum << endl;
cout << "" << endl;
}
if(x==8){ //random
cout << "Welcome to the random number genarator menu!" << endl;
cout << "" << endl;
cout << "Enter how many numbers you want to be generated" << endl;
cout << "" << endl;
cin >> y;
cout << "" << endl;
cout << "Enter the minimum value" << endl;
cout << "" << endl;
cin >> d;
cout << "" << endl;
cout << "Enter the maximum value" << endl;
cin >> k;
cout << "" << endl;
srand(time(0));
for(int x = 1; x<y+1;x++){
cout << d+(rand()%k) << endl;
}
cout << "" << endl;
}
if(x==9){ //Quiz
cout << "Type 'one' for the quiz" << endl;
cout << "" << endl;
cin >> u;
cout << "" << endl;
if(u=="one"){
cout << "What is 284 + 127? \n"; //question 1 starts
cin >> Q1;
cout << " " << endl;
if (Q1 == ans1){
cout << "Well done, the answer was indeed 411" << endl;
cout << "" << endl;
score++;
}else{
cout << "Nope, the answer was not " << Q1 << " but was 411" << endl;
cout << "" << endl;
score += 0;
}
cout << " \n";
cout << "If X = 7 then what is Y when Y = X^2 + 44?" << endl;
cin >> Q2;
cout << " " << endl;
if (Q2 == ans2){
cout << "Well done, the answer was indeed " << ans2 << endl;
cout << "" << endl;
score++;
}else{
cout << "Nope, the answer was not " << Q2 << " but was 93" << endl;
cout << "" << endl;
score += 0;
}
cout << " \n";
cout << "Work out X in this equation: 5x + 100 = 1000" << endl;
cin >> Q3;
cout << " " << endl;
if (Q3 == ans3){
cout << "Well done, the answer was indeed 180" << endl;
cout << "" << endl;
score++;
}else{
cout << "Nope, the answer was not " << Q3 << " but was 180" << endl;
cout << "" << endl;
score += 0;
}
cout << " \n";
cout << "What number does DCCLXXXIX mean?" << endl;
cin >> Q4;
cout << " " << endl;
if (Q4 == ans4){
cout << "Well done, the answer was indeed 789" << endl;
cout << "" << endl;
score++;
}else{
cout << "Nope, the answer was not " << Q4 << " but was 789" << endl;
cout << "" << endl;
score += 0;
}
cout << " \n";
cout << "When P = 13.5 and F = 9: What does E equal when P*E = F^2" << endl;
cin >> Q5;
cout << " " << endl;
if (Q5 == ans5){
cout << "Well done, the answer was indeed 6" << endl;
cout << "" << endl;
score++;
}else{
cout << "Nope, the answer was not " << Q5 << " but was 6" << endl;
cout << "" << endl;
score += 0;
}
cout << "your final score is... " << score << "/5" << endl;
cout << " " << endl;
switch(score){
case 5:
cout << " " << endl;
cout << "Amazing, 5/5 is pretty tough!" << endl;
cout << " " << endl;
break;
case 4:
cout << " " << endl;
cout << "Pretty good, 4/5 is a good feat!" << endl;
cout << " " << endl;
break;
case 3:
cout << " " << endl;
cout << "okay, 3/5 is an okay score" << endl;
cout << " " << endl;
break;
case 2:
cout << " " << endl;
cout << "Good... ish , 2/5 isn't hard to do" << endl;
cout << " " << endl;
break;
case 1:
cout << " " << endl;
cout << "This is bad, 1/5 is pretty bad" << endl;
cout << " " << endl;
break;
case 0:
cout << " " << endl;
cout << "What, are you 3? 0/5 is unacceptable" << endl;
cout << " " << endl;
}
}
}
if(x==10){ //Celc to faren
cout << "Welcome to the celcuis to farenheit converter!" << endl;
cout << "" << endl;
cout << "Enter celcuis: " << endl;
cout << "" << endl;
cin >> celc;
cout << "" << endl;
sum = (celc * 1.8);
sum1 = (sum + 32);
cout << celc << " celcius is " << sum1 << " farenheit" << endl;
cout << "" << endl;
}
if(x==11){
cout << "Welcome to the farenheit to celcius converter!" << endl;
cout << "" << endl;
cout << "Enter farenheit" << endl;
cin >> faren;
cout << "" << endl;
sum = (faren - 32);
sum1 = (sum / 1.8);
cout << faren << " farenheit is " << sum1 << " celcuis" << endl;
cout << "" << endl;
}
if(x==12){
int score = 0;
int qe1;
int qe2;
int qe3;
int qe4;
int qe5;
int qe6;
int qwe1 = 1;
int qwe2 = 2;
int qwe3 = 3;
int qwe4 = 4;
int qwe5 = 5;
int qwe6 = 6;
cin >> qe1;
cin >> qe2;
cin >> qe3;
cin >> qe4;
cin >> qe5;
cin >> qe6;
if(qe1 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
score = score + 10;
}else{
}
if(qe2 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
score = score + 10;
}else{
}
if(qe3 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
score = score + 10;
}else{
}
if(qe4 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
score = score + 10;
}else{
}
if(qe5 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
score = score + 10;
}else{
}
if(qe6 == qwe1, qwe2, qwe3, qwe4, qwe5, qwe6){
score = score + 10;
}else{
}
cout << "" << endl;
cout << score << endl;
}
}