guys sorry about my post earlier . this is what i did with my program but i dont think my equation is correct because whenever i want to get
the total amount due it always give the wrong amount . i dont thinks this equation is correct "amount=amount+price*quant;"
guys i need your help. Thank you!
#include<iostream>
#include <windows.h>
using namespace std;
void gotoxy(long x, long y)
{
COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
main()
{
char name [25];
int order;
int quant=0;
int amount=0;
double cash;
double change;
char again;
char another;
int a, x;
int cq=0;
do
{
cout<<"\t\t\tTAPSI NI VIVIAN'S MENU";
gotoxy(1,2);
for(x=1; x<=6; x++)
{
cout<<"\n"<<x<<".";
cout<<"\n";
}
gotoxy(3,3);
cout<<"Tapsilog=P80.00" <<"\t\t\t" <<"7. Beef Mami=P50.00";
gotoxy(0,4);
for(a=0; a<=70; a++)
{
cout<<"-";
}
gotoxy(3,5);
cout<<"Tosilog=P80.00" <<"\t\t\t" <<"8. Bottled Softdrinks=P25.00";
gotoxy(0,6);
for(a=0; a<=70; a++)
{
cout<<"-";
}
gotoxy(3,7);
cout<<"Longsilog=P95.00" <<"\t\t\t" <<"9. Canned Softdrink=P25.00";
gotoxy(0,8);
for(a=0; a<=70; a++)
{
cout<<"-";
}
gotoxy(3,9);
cout<<"Bulalo=P225.00"<<"\t\t\t" <<"10. Minute Maid=P30.00";
gotoxy(0,10);
for(a=0; a<=70; a++)
{
cout<<"-";
}
gotoxy(3,11);
cout<<"Sisig with Egg=P140.00"<<"\t\t"<<"11. Nestea=P20.00";
gotoxy(0,12);
for(a=0; a<=70; a++)
{
cout<<"-";
}
gotoxy(3,13);
cout<<"Goto=P40.00"<<"\t\t\t\t"<<"12. Bottled watter=P15.00";
gotoxy(0,15);
cout<<"\nCustomer name: ";
gets(name);
do
{
cout<<"\nHello there "<<name<<", welcome to Tapsi Ni Vivian! What is your order? ";
cin>>order;
cout<<"How many orders will that be?: ";
cin>>quant;
if (order==1)
{
amount=amount+80*quant;
}
else if (order==2)
{
amount=amount+80*quant;
}
else if (order==3)
{
amount=amount+95*quant;
}
else if (order==4)
{
amount=amount+225*quant;
}
else if (order==5)
{
amount=amount+140*quant;
}
else if (order==6)
{
amount=amount+40*quant;
}
else if (order==7)
{
amount=amount+50*quant;
cq=quant;
}
else if (order==8)
{
amount=amount+25*quant;
cq=quant;
}
else if (order==9)
{
amount=amount+25*quant;
cq=quant;
}
else if (order==10)
{
amount=amount+30*quant;
cq=quant;
}
else if (order==11)
{
amount=amount+20*quant;
cq=quant;
}
else if (order==12)
{
amount=amount+15*quant;
cq=quant;
}
else;
cout<<"Want to add an another order? (Y or N): ";
cin>>again;
cout<<"\n";
}while (again=='y'||again=='Y');
cout<<"Customer name: "<<name;
cout<<"\nYour total amount is P"<<amount;
cout<<"\nTotal cash: P";
cin>>cash;
change=cash-amount;
cout<<"Your change will be P"<<change;
cout<<"\n\nThank you for ordering "<<name<<", please come again soon! :)";
cout<<"\n\nAre there any more customers? (Y or N): ";
cin>>another;
cout<<"\n\n";
if (another=='y'||another=='Y')
system("cls");
else
cout<<"***end of program***";
cin.ignore();
}while(another=='y'||another=='Y');
cout<<"\n\n";
system ("pause");
return 0;
}
<iostream> 0 Newbie Poster
David W 131 Practically a Posting Shark
Ancient Dragon commented: excellent advice +14
Amiira ahmet 15 Newbie Poster
rproffitt commented: I have to ask why you would hide your request under a 7+ year old discussion. +15
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.