I've writen a simple calculator code it is pasted below. What do I need to change in order to make it loop using a "while" statement until, the user inputs the letter ("Q" upper or lower), casuing it to exit the program instead of a function such as(/,*,-,+).. please help...
#include <iostream>
using namespace std;
int main()
{
int x,y;
char z;
char q;
cout<<"please input an expression (two numbers and a function) to be solved, when u wish to quit simply type q instead of a function into an equation"<<endl;
cin>>x>>z>>y;
switch(z)
{
case '+':
cout<<"The sum is "<<x+y<<endl;
break;
case '-':
cout<<"The difference is "<<x-y<<endl;
break;
case '*':
cout <<"The product is " <<x*y<<endl;
break;
case '/':
if (y==0)
{
cout<<"Can't divide by 0 "<<endl;
}
else
cout<<"The quotent is " <<x/y<<endl;
cout<<endl;
return 0;
}
}