//ask the user for a set of data, product price & amount. calculate the total cost of the product.
//cotinue to ask the user for different sets of data until th user wants to exit
// print the total cost for all the products he bought
int main(int argc, char** argv) {
using namespace::std;
int price, amount, total;
do {
cout << "Enter '0' to exit";
cout << endl;
cout << "Enter the price of the item";
cin >> price;
cout << "Enter the amount of the item you are purchasing";
cin >> amount;
#include <iostream>
int main( /* int argc, char** argv */ )
{
usingnamespace::std;
int price;
int amount;
int total = 0 ; // initialise total to zero
do
{
cout << "Enter '0' to exit\nEnter the price of the item: ";
cin >> price;
if( price == 0 ) break ;
cout << "Enter the amount of the item you are purchasing: ";
cin >> amount;
constint subtotal = price * amount;
cout << "subtotal: " << subtotal << '\n';
total += subtotal ; // add subtotal to total
}
while( /* ( price != 0 ) || */ ( amount != 0 ) );
std::cout << "grand total: " << total << '\n' ;
//return 0;
}