constexprint MAXSIZE{ 8 }; // <--- You can make more use of it here.
//struct for menuItemType
struct menuItemType
{
string menuItem;
double menuPrice;
void SetValues(std::string item, double price)
{
menuItem = item;
menuPrice = price;
}
};
using ITEM = menuItemType[MAXSIZE];
void getData(ITEM& menuList);
The function then becomes:
1 2 3 4 5 6
void getData(ITEM& menuList)
{
menuList[0].SetValues("Plain Egg", 1.45 );
menuList[1].SetValues("Bacon and Egg", 2.45);
// <--- The rest here.
}
Or againtry has another alternative.
This is the output I get:
Welcome to Johnny's Resturant
You can make up to 8 single order selections
[ 1]Plain Egg$1.45
[ 2]Bacon and Egg$2.45
[ 3]Muffin$0.99
[ 4]French Toast$1.99
[ 5]Fruit Basket$2.49
[ 6]Cereal$0.69
[ 7]Coffee$0.5
[ 8]Tea$0.75
Do you want to make selection Y/y (Yes), N/n (No):
y
Enter item number
1
Do you want to make selection Y/y (Yes), N/n (No):
y
Enter item number
2
Do you want to make selection Y/y (Yes), N/n (No):
y
Enter item number
3
Do you want to make selection Y/y (Yes), N/n (No):
n
Thanks for eating at Johnny'sCustomer check:
Plain Egg $1.45
Bacon and Egg$2.45
Muffin $0.99
Tax 0.245
Total 5.13
You really need to make it look better.
I think it is required that you output the line "Do you want to make selection Y/y (Yes), N/n (No): ". If you leave off the "endl", better to prefer using (\n), the input will be on the same line as the prompt.
Welcome to Johnny's Resturant
----------MENU ITEMS----------
[ 1]Plain Egg$1.45
[ 2]Bacon and Egg$2.45
[ 3]Muffin$0.99
[ 4]French Toast$1.99
[ 5]Fruit Basket$2.49
[ 6]Cereal$0.69
[ 7]Coffee$0.5
[ 8]Tea$0.75
You can make up to 8 single order selections
Do you want to make selection Y/y (Yes), N/n (No): y
Enter item number1
Select another item Y/y (Yes), N/n (No): y
Enter item number2
Select another item Y/y (Yes), N/n (No): n
Welcome to Johnny's Resturaunt
Plain Egg $1.45
Bacon and Egg$2.45
Tax $0.20
Amount Due $4.10