Answer to Question #8617 in C++ for marissa
Calculate the total payment ( payment = quantity * price ).
Display the quantity, price and payment.
Repeat the program as long as the user key in ‘1’.
Use while loop for this question.
using namespace std;
int main(int argc, char *argv)
int quantity = 0;
int price = 0;
int payment = 0;// = quantity * price
char ch = '1';
//Repeat the program as long as the user key in ‘1’.
while(ch == '1')
cout << endl;
cout << "Enter Quantity:";
cin >> quantity;
cout << "Enter Price:";
cin >> price;
//Display the quantity, price and payment.
payment = quantity * price;
cout << "Quantity: "
<< quantity << endl;
cout << "Price: "
<< price << endl;
cout << "Payment: "
<< payment << endl << endl;
cout << "Do You want repeat?(press '1' to continue) ";
quantity = 0;
price = 0;
payment = 0;
ch =_getch ();
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!