International Book Fair which was held for 30 days attracted many visitors. Only those visitors
with passes were allowed to enter. Number of passes issued for each day was recorded. You
need to analyze the success of the book fair based on the following:
(a) calculates the total visitors who went to the book fair.
(b) calculates the average number of visitors.
(c) calculates the number of days which has the number of visitors more than 50.
int main() { int *visitors; visitors = new int[30]; srand((unsigned) time(NULL)); for (int i = 0; i < 30; i++) { & visitors[i] = rand() % 100; } cout << "--------------------" << endl; cout << setw(6) << "Day" << setw(10) << "Visitors" << endl; cout << "--------------------" << endl; for (int i = 0; i < 30; i++) { & cout << setw(6) << i + 1 << setw(10) << visitors[i] << endl; } cout << "--------------------" << endl; int total = 0; double average = 0; int number = 0; for (int i = 0; i < 30; i++) { & total += visitors[i]; & if (visitors[i] > 50) & number++; } average = total / 30; cout.setf(ios::fixed); cout.precision(2);
cout << endl; cout << "(a) Total visitors who went to the book fair: quot; << total & lt;< endl; cout << "(b) Average number of visitors: quot; << average & lt;< endl; cout << "(c) Number of days which has more than 50 visitors: quot; << number & lt;< endl;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment