calculate daily sales for each item in the café for a week.
#include <iostream>
using namespace std;
int main(){
int numberItems;
int numberItemsSold;
float price;
float dailySales=0;
cout<<"Enter the number of items: ";
cin>>numberItems;
for(int i=0;i<numberItems;i++){
cout<<"\nEnter the price of item "<<(i+1)<<": ";
cin>>price;
cout<<"Enter the number of items "<<(i+1)<<" sold: ";
cin>>numberItemsSold;
dailySales+=price*numberItemsSold;
}
cout<<"\nThe daily sales = "<<dailySales<<"\n";
system("pause");
return 0;
}
Comments
Leave a comment