this is my code
so i would like to know how to not do float number 2 when the operation is square root.
using namespace std;
float number1()//the function that gets the first number
cout<<"please enter a number:";
cin>> x;//this is where the number is stored
return x;//the value of x is now "float number1()"
cout<<"please enter a operation (x, / , - , +, ^, s(square root for first number))";
cout<<"please enter another number:";
float x = number1();//saying the variable x is the function "float number1()"
char a = operation();
float y = number2();
//this next part decides if you add, multiply, divide, or subtract depending on the input
answer = x*y;
answer = x/y;
answer = x+y;
answer = x-y;
case '^'://pow is power (like 1 to the tenth power)
answer = pow (x,y);
case 's'://sqrt is square root
answer = sqrt (x);
float answer = math();
cout<< answer <<"\n";