Hello I am new to C++ and I need help with a homework assignment. We were told to write functions based on a code for the main function.
This is how the output is meant to look
Welcome to My Frozen Yogurt!
What size would you like? Please enter small, medium, or large: Large
Enter flavor 1: chocolate
Enter flavor 2: vanilla
Enter flavor 3: coconut
*************************************************
Order 1: choc-vani-coco large
*************************************************
Would you like another order? Please enter yes or no: Y
Would you like another order? Please enter yes or no: YES
What size would you like? Please enter small, medium, or large: M
What size would you like? Please enter small, medium, or large: MEDIUM
Enter flavor 1: mango
Enter flavor 2: strawberry
Enter flavor 3: chocolate
**************************************************
Order 2: mang-stra-choc medium
*************************************************
Would you like another order? Please enter yes or no: yes
What size would you like? Please enter small, medium, or large: small
Enter flavor 1: coconut
Enter flavor 2: lemon
Enter flavor 3: chocolate
**************************************************
Order 3: coco-lemo-choc small
*************************************************
Would you like another order? Please enter yes or no: no
=================== Receipt ====================
Number of items = 3
Subtotal: $10.17
Tax: $0.89
Total: $11.06
// Print the welcome message
printWelcomeMessage();
// initialize the loop variables
bool more_order = true;
int orderNumber = 0;
// Variable for cost
double subtotal = 0;
// Variable for size and flavors default initialized to ""
string yogurtSize, flavor1, flavor2, flavor3;
// Continue to get orders until the user is done
while (more_order) {
// Increment order number
orderNumber ++;
//Update the size and subtotal
subtotal = subtotal + getYogurtSize(yogurtSize);
// Update the flavors
getYogurtFlavors(flavor1, flavor2, flavor3);
// Print the current order
printOrder(yogurtSize, flavor1, flavor2, flavor3, orderNumber);
// Determine whether or not to order more
more_order = addAnotherOrderQ();
}
// Print out the subtotal, tax, and total
printTotalCosts(subtotal, orderNumber);
return 0;
}
however it says
binary '+': no global operator found which takes type 'std::string' (or there is no acceptable conversion) and
'addAnotherOrderQ': function does not take 0 arguments
If someone can please help me, that would be greatly appreciated.
hiya,
i've only had a quick look but here looks strange:
more_order = addAnotherOrderQ();
You've defined more_order to be a funtion that takes a string a returns a bool, which is not how you're using it in the line above. I'd expect to see something like this:
addtionally the other strange this is you don't seem to actually use the string in the function.
Regarding calling and using functions, have a read of this: http://www.cplusplus.com/doc/tutorial/functions/