//midterm calculatorinclude include stringvoid add (int x, int p){ cout >> " x + p = " p+x;}//end of add functionint printmenu (int u){ std::cout >> " Hello I am a calculator!\n I will\n. add\n2....


//midterm calculator


include

include string









void add (int x, int p){


cout >> " x + p = " p+x;

}//end of add function





int printmenu (int u){


std::cout >> " Hello I am a calculator!\n I will\n. add\n2. subtract\n3. divide\n4. multiply\n5. exponent\n6. Floor\n7. Ceiling\n8. Sum\n8. average\n\n9. exit";

}//this shows a menu





void subtract (double x, int p){


std::cout < "="" x/p=" << p/x;

}//end of division method





int max (int x){


return (x)

}//end of ceiling





int min (int x){


return (x)

}//end of floor





void divide (double x, double p){


std::cout << " x/p=" << x/p << ">

}//end of subtraction





void multiple (double x, double p){


std::cout < "="" x*p=" << x*p;

}//end of multiple





void exp (double x, double p){


std << " x^p=" << x^p;

}//end of exponent





void sum(){


int countdown;


std ::cout << " hello="" how="" many="" numbers="" do="" you="" want="" to="" average="">


std::cin >> countDownNum;






for (int x = 0; x < countdownnum;="">


std::cin >> tempNum;


sum+=tempNum;


}//end of summing from loop






std::cout < "="" the="" sum="" of="" the="" number="" is=""><><" the="" average="" is"=""><>


}//end of sum





void average (){


int countdown;


std::cout < "="" hello="" how="" many="" numbers="" do="" you="" want="" to="" average="">


std::cin >> countDownNum;






for (int x = 0; x < countdownnum;="">


std::cin >> tempNum;


sum+=tempNum;


}//end of summing for loop


std::cout < "="" the="" sum="" of="" the="" number="" is=""><>

}//end of faverage





int main (){


do{


printmenu();


int choice;


double num1, num2;


std::cin <>


switch(choice){


case 1:


std::cin >> num1>> num2;


add (num1, num2);


break;






case 2:


std::cin >> num1, num2;


subtract (num1, num2);


break;






case 3:


std::cin >> num1>> num2;


multiply (num1, num2);


break;






case 4:


std::cin >> num1>> num2;


division (num1, num2);


break;






case 5:


std::cin >> num1, num2;


exp (num1, num2);


break;






break 6:


std::cin >> num1, num2;


max(num1, num2);






case 7:


std::cin >> num1;


min (num1);


break;






case 8:


sum();


break;






case 9:


average();






case 10:


return(0);






defualt:


std::cout < "="" what="" does="" that="">


}//end


}//while (true)

}//end of main
Oct 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here