my code is

and to get the answer for square root you have put in input for y to take in, I was wondering how to avoid taking in input for y only in the square root function.Code:#include <iostream> #include <cmath> using namespace std; float math() { float x; float y; char a; float answer; cout<<"enter an problem (operations are x,/,+,-,^,s2(square root))"; cin>> x >> a >> y; switch (a){ case 's': answer = sqrt (x); break; case 'x': answer = x*y; break; case '/': answer = x/y; break; case '+': answer = x+y; break; case '-': answer = x-y; break; case '^': answer = pow (x,y); break; } return answer; }

Thank you