I am just trying to end this program when the user chooses x or X but without the default "Enter a valid operator." The rest of the program works great (thanks to previous help). Sorry this isn't pasting perfectly.

do 
		   {
			   cout << "Enter an operation: + - * /  (or enter X to exit):"; cin >> oper;
			   switch (oper)
			   {
				   case '+':
					cout << "Enter a number: "; cin >> num; 
					tot = tot + num;
					cout << "Current total is " << tot << endl;
					break;
				   case '-':
			   		cout << "Enter a number: "; cin >> num;
					tot = tot - num;
					cout << "Current total is " << tot << endl;
					break;
				   case '*':
			   		cout << "Enter a number: "; cin >> num;
					tot = tot * num;
					cout << "Current total is " << tot << endl;
					break;
				   case '/':
			   		cout << "Enter a number: "; cin >> num;
					if (num == 0)
					{
					   cout << "Can not divide by zero!" << endl;
					}
					else
					{
					tot = tot / num;
					}
					cout << "Current total is " << tot << endl;
					break;
				   default: cout << "Enter a valid operator." << endl;
			   }
		   }while (oper != 'X' && oper != 'x');

This solved it.

case 'x': cout << ""; break;
case 'X': cout << ""; break;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.