The option could look like: "To run the program again enter 'y', to exit enter 'n'. In my program I ask the user to enter a package A,B, or C. Then I calculate the price based on different factors. But I have to give the user the option to select another package an rerun the entire program?
#include <iostream>
using namespace std;
int main() {
bool finished = false;
char choice;
int choice_a = 995;
int choice_b = 1995;
int choice_c = 3995;
int message_units;
int price;
bool selected = false;
do {
do { //Prompt user to enter package
cout << "Which package do you choose (enter A, B or C)" << endl;
cin >> choice;
if (choice == 'A') { price = choice_a; selected = true; }
else if (choice == 'B') { price = choice_b; selected = true; }
else if (choice == 'C') { price = choice_c; selected = true; }
cout << endl;
}
while (selected == false);
//Prompt user to enter message units
cout << "How many message units (enter 1 - 672)" << endl;
cin >> message_units;
//calculate message units
if((message_units > 5) && (choice == 'A')){
price += 100 * (message_units - 5);
}
if((message_units > 15) && (choice == 'B')){
price += 50 * (message_units - 15);
}
//Total Cost
cout << "Your total cost is " << price/100 << "." << price%100 <<