English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Write a C++ program
1]reads products code
2]if product code=0 print total amount

Totalamount++=price * quantity

2007-10-20 05:04:42 · 2 answers · asked by Anonymous in Education & Reference Homework Help

2 answers

#include
using namespace std;

int main ()
{
int price=0;int t=0;
int quantity=0;
int productcode=0;

cin>> productcode>>quantity>>price;
if (!productcode) {
t+=price * quantity
}
cout <<"total amount = ";
cout <
return 0;
}


and for those who want to loop :

while (1) {
... read ...
if (productcode==0) break;
}

2007-10-20 05:11:44 · answer #1 · answered by gjmb1960 7 · 0 0

I might be able to help, but you have to explain more clearly.
What product code are you referring to?

if (productCode==0)
cout>>totalAmount

2007-10-20 12:09:59 · answer #2 · answered by jackbondnj 5 · 0 0

fedest.com, questions and answers