Can anybody tell what I need to do to make this program restart after it finishes without having to exit? Some kind of loop or something...???
#include <iostream>
using namespace std;
int main ()
{
double operand1, operand2;
double sum, difference, quotient;
char choice;
cout << "\n\nBASIC CALCULATOR\n"
<< "a. Addition\n"
<< "b. Subtraction\n"
<< "c. Division\n\n"
<< "d. Quit\n\n";
//Get the choice
cout << "Insert Option:";
cin >> choice;
//Switch to deal with four cases
switch (choice)
{
case 'a': cout << "\n\nInput Operands: " << "\n\n";
cin >> operand1 >> operand2;
sum = operand1 + operand2;
cout << "The sum is " << sum << "\n\n";
break;
case 'b': cout << "\n\nInput Operands: " << "\n\n";
cin >> operand1 >> operand2;
difference = operand1 - operand2;
cout << "The difference is " << difference << "\n\n";
break;
case 'c': cout << "\n\nInput Operands: " << "\n\n";
cin >> operand1 >> operand2;
quotient = operand1 / operand2;
cout << "The quotient is " << quotient << "\n\n";
break;
case 'd': break;
default:
cout << "Input Error!";
}
return 0;
}