``````guys help with this. sorry about my post earlier. im just new here in daniweb comm. i dont know the rules yet.
i have a problem . i don't know the correct equation for this one. i don't get the correct answer .please help. amount=amount+price*quant; is this correct?

#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
{
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<<"\nTotal cash: P";
cin>>cash;

change=cash-amount;

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;
}
``````

Since you are using C++, why not use C++ string (not C string)

And don't use (risky) gets ... (even in C)
In C++ with C++ string

`#include <string>`

then can code

``````string cppStr;
cin >> cppStr';
// or ...
getline( cin, cppStr );
``````

Also !

it is ...

``````int main() // main returns an int
{
return 0;
}
``````

Also ...

``````// else; // NOT what you want //
else
{ // need this ...
cout<<"Want to add an another order? (Y or N): ";
cin>>again;
cout<<"\n";
} // need { ... } to include the whole 'else' block
``````

Need other fixes ... this is a start :)

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.