#include <iostream>
using namespace std;
int main() {
cout << "How many volunteers?\n";
int vol;
cin >> vol;
cout << "What is the price of one box?\n";
int cost;
cin >> cost;
int total = 0;
for (int i = 1; i <= vol; i++) {
cout << "Enter name of volunteer " << i << endl;
string name; //no need to store
cin >> name;
cout << "Enter number of boxes sold:\n";
int boxes;
cin >> boxes;
total += boxes;
}
cout << "Total number of boxes of cookies sold: " << total << endl;
cout << "Total revenue generated by selling the cookies: $" << cost * total << endl;
cout << "Average number of boxes sold by each student: " << (float)total / vol << endl;
}
Comments
Leave a comment