#include<iostream>
using namespace std;
int main()
{
int SIZE = 5;
float COFFEEPRICE = 2.00;
int products[SIZE]="Whipped cream", "Cinnamon", "Chocolate sauce", "Amaretto", ""Irish whiskey";
float prices[SIZE]=0.89, 0.25, 0.59, 1.50, 1.75
int totalPrice = 0
int choice = 0
int SENTINEL = -1
while (choice <> SENTINEL)
cout<<"Please select an item from the Product menu by selecting the item number (1 - 5) or -1 to terminate: ";
cout<<"Product Price ($)";
cout<<"======= =========";
cout<<"1. Whipped cream 0.89";
cout<<"2. Cinnamon 0.25";
cout<<"3. Chocolate sauce 0.89";
cout<<"4. Amaretto 1.50";
cout<<"5. Irish whiskey 1.75";
cout<<"Please enter a positive number: ";
cin>>choice;
if (choice <> -1) then
if ((choice >= 1) and (choice <= 5)) then
totalPrice = totalPrice + prices[choice-1]
cout<<"Item number ", choice,": ", products[choice-1], " has been added"
else
cout<<"Item number ",choice, " is not valid", "Sorry we do not carry that item"
cout<<endif
cout<<endif
endwhile
totalPrice = totalPrice + COFFEEPRICE
cout<<"Total price of order is ",totalPrice
cout<<"Thanks for purchasing from Jumpin Jive Coffee Shop"
My task is Design a program that will allow a user to enter ordered add-ins continuously until the value entered is not on the list. After each item display its price or the message we do not have that . After all the items have been entered output the total price of the order
int products[SIZE]="Whipped cream", "Cinnamon", "Chocolate sauce", "Amaretto", ""Irish whiskey"; strings of characters are not the same as integers.
<> this is not the less than or greater than operator or what are you trying to do?
Also you need a opening brace { after your while statement and a closing brace } to end the while loop not a endwhile statement. Youa re probably getting several compiler errors. Same thing with your if statements.
You need operator << to seperate message and not commas in your output statements.
Sorry I have no time , maybe if I discovered this site earlier :(
Its ok, ill be passing this in 1hour left thanks for the time :D
I have to read sorry for the inconvinience
Im too shy :(
and I have to commute to my school for 30 minutes ( it is sooo far )
Thanks for the care, Sorry TarikNeaj and giblit and thank you for replying :)