Question
Write a program, eventsfunc.c, which uses two functions readvalues() and revenue() to find the total hall revenue, as well as the id numbers associated with
Write a program, eventsfunc.c, which uses two functions readvalues() and revenue() to find the total hall revenue, as well as the id numbers associated with the most attended and most profitable events from the data stored in events.txt. You can assume that the number of values in the input file is less than 100.
Your main must use the following steps:
open the two files events.txt and events.out.
call the function readvalues() which reads the values from events.txt into the arrays ID, tickets and tprice and returns the value of n (number of values in the file).
call the function revenue() which computes the total hall revenue from values found in the array using the same formula as Assignment 3 Question 5. The function should also return the id numbers of the most profitable and most attended events.
write the number of events examined, the total revenue, and the determined id numbers to the file events.out
Your output file should look like:
Number of events reviewed:6
Hall Revenue: $12801.34
Most profitable event this quarter had id: 504
Most attended event this quarter had id: 402
/* File: eventsfunc.c
Three sets of values are read from a file into corresponding arrays using the funtion readvalues().
The function revenue() is called to compute the hall revenue and determine the most profitable, and the most attended events.
#include
#define MAXN 100
events.txt:
401 486 42.95 402 653 0.00 403 250 24.95 404 167 19.95 405 345 84.85 501 607 31.45 502 218 54.95 601 145 65.85 602 283 10.90 603 762 5.00 604 375 34.45 605 427 29.95 606 352 12.89
Please I ask of you kindly, to not use strings, cout cin and fp instead of printf, scanf and FILE *fin or four = fopen("");
Thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started