Answer to Question #185090 in C++ for Tang Zi Qin

Question #185090

calculate daily sales for each item in the café for a week.


1
Expert's answer
2021-04-24T15:13:44-0400
#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;
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS