In: Computer Science
// C++ program to compute the total billing amount for the
ordered items
#include <iostream>
using namespace std;
int main()
{
// initialize total cost to 0
double total_cost = 0, cost;
int num_items;
// input the number of items ordered
cout<<"Sonia, enter the number of items ordered: ";
cin>>num_items;
// for loop to input cost for each item, adding it to total
cost
for(int i=0;i<num_items;i++)
{
cout<<"Enter the cost of item-"<<(i+1)<<":
";
cin>>cost;
total_cost += cost;
}
// if number of items > 0 and total cost < 1000, add
shipping cost of 10AED/item
if(num_items > 0 && total_cost < 1000)
total_cost += (10*num_items);
// display the total billing amount
cout<<"Total billing amount: "<<total_cost<<"
AED"<<endl;
return 0;
}
//end of program
Output: