User is asked to input if they have a meal plan.
User inputs a string "yes" or "no"
My problem is running the if/else to later calculate the cost of a meal plan if the answer yes = true.
I have this so far:
Expand|Select|Wrap|Line Numbers
- const double MEAL_PLAN = 1245.00;
- int num1 = 0;
- string str1 = "yes"
- string str2 = "no"
- cout << " Please enter yes or no for meal plan: ";
- cin >> str1, str2;
- if ( str1 != str2){
- meal_plan = true;
- }
- else
- {
- meal_plan = false;
- }
- cout << endl;
- cout << "Meal Plan: " ;
- if (meal_plan == true){
- MEAL_PLAN; // to return cost of meal plan
- }
- else
- {
- num1; // to return 0
- }
Any ideas?
Thank you,
Suemez