The names of these candidates are in the input file


In the file quizin1.dat (which you should cp to your directory), each line represents a voting card of a registered voter. The character '1'
in the i-th indicates that the vote was cast for the i-th candidate. The first 10 columns were for ten candidates for the Governor of California.
The names of these candidates are in the input file quizin2.dat (cp it to your directory).

Open the files quizin1.dat and quizin2.dat by using the file pointers *finput1 and *finput2. Use the file pointer *foutput1 for the output file quizout1.dat. Read the file quizin1.dat by using fgets().
Count the total number of voting cards, and the number of votes cast for each of ten candidates. Use a character array: votes[80]
for votes, and an integer array: cand[10] for the candidates.
Print these results on the screen, and the numerical results in the output file quizout1.dat. The printout on the screen should be as shown below,while the file quizout1.dat should contain integers cand[0], cand[1],..., cand[9] (either in one line or in separate lines).

Close the input file quizin1.dat and the output file quizout1.dat.

Then, open the created output file quizout1.dat for reading by using the file pointer *finput3. Read the numerical data from this file by using while(fscanf(finput3,...), and calculate the percentage of votes that each of the ten candidates received.
Within the while(fscanf(finput3),...) loop,use fgets(cand_name,40,finput2) in conjunction with sscanf(cand_name, "%s %s", name, surname) to scan the surname of the candidate and make the printout on the screen and in the output file quizout2.dat, poited to by the pointer *foutput2, as shown below.
Use the format %-16s when printing the string surname.

Close the files quizout1.dat and quizin2.dat.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: The names of these candidates are in the input file
Reference No:- TGS0137378

Expected delivery within 24 Hours