Help Me , I need to learn this and I have to pass PLEASE :'(

#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"



return 0;
}
Help you with what? Whats your problem exactly. Elaborate.

Also, please edit your post and put your code between code tags - http://www.cplusplus.com/articles/jEywvCM9/
Last edited on
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
#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]=1.00,1.50,2.00,4.00,5.00 //I change this
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.

I would suggest reading up on control structures for c++. http://www.cplusplus.com/doc/tutorial/control/


here are even more tutorials
http://www.cplusplus.com/doc/tutorial/
http://www.learncpp.com/


Edit you also have several lines that are missing their semi-colons since each statement must end with a semi-colon.
Last edited on
the coffee price is 85 :(
Sorry
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
If you still have time, and you got skype. PM me your skype and I'll help you out.
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 :)
Goodluck :)
Ok, I will :)
Ps. I know that Im wrong what I did there, im too lazy to edit it :) Sorry
Bye for now, until the next time :)
Topic archived. No new replies allowed.