subject

You will be creating a quiz grading program. You will compare the student's answers with the correct answers, and determine if the student passed the quiz or not. The program will make use of two parallel arrays.
Each array must be able to support up to 20 characters (so you have two arrays of chars, each one with 20 elements).
Your program will need to read in the student input file name from cin. It will also need to read in the answer file name from cin.
The contents of the student input file should be read into one char array. The file will contain 20 characters, each character on a separate line of the file. The first line in the input file will contain the students answer to the first question, the second line will contain the student's answer to the 2nd question, and so on for 20 questions. The answers are A, B, C or D (all upper case).
The answer file will be read in as well, one answer per line for 20 answers. The first line of text is the answer for question 1, then second line is the answer for question 2, and so on.
As always, close the input files when you are done with them.
Your program needs to determine the number of questions that the student missed and then display the following:
A list of questions missed by the student, showing the question number (1 through 20), the correct answer, and the incorrect answer.
The total number of questions missed by the student
The percentage of the questions answered correctly.
If the percentage of questions answered correctly is 70% or more indicate that the student passed, otherwise state that the student failed the quiz.
You need to have at least the following three functions, including main.
Read function
One function needs to be passed a char array of size 20, it also needs to be passed an input file name. The return from the function should be a bool value.
The function should open the input file and read the contents into the array that was passed to it. If the file could not be opened it should return back false. If the read was successful the program should return back true.
Display function
The display function will be passed the two arrays and should calculate and display the results from the program.
The main function
The main will call the read function twice, once for each input file. The student file should be processed first and then the answers file. If the read function works with the student file the program should call the read function for the answer file If the second call to the read function also works the display function should be called. If either call to the read function does not work it should output a message stating that the specific file could not be opened. No further processing should be done if either one of the files cannot be opened.
As always you cannot use any global variables in your program.
See the sample runs for the output requirements.
Sample run 1 (valid data)
Contents of cin:
student. txt
answers. txt
Contents of student. txt:
A
B
C
D
A
B
C
D
A
B
C
D
A
B
C
D
A
B
C
D
Contents of answers. txt:
A
A
A
A
B
B
B
B
C
C
C
C
D
D
D
D
A
B
C
D
Here is the output to cout:
Question 2 has incorrect answer 'B', the correct answer is 'A'
Question 3 has incorrect answer 'C', the correct answer is 'A'
Question 4 has incorrect answer 'D', the correct answer is 'A'
Question 5 has incorrect answer 'A', the correct answer is 'B'
Question 7 has incorrect answer 'C', the correct answer is 'B'
Question 8 has incorrect answer 'D', the correct answer is 'B'
Question 9 has incorrect answer 'A', the correct answer is 'C'
Question 10 has incorrect answer 'B', the correct answer is 'C'
Question 12 has incorrect answer 'D', the correct answer is 'C'
Question 13 has incorrect answer 'A', the correct answer is 'D'
Question 14 has incorrect answer 'B', the correct answer is 'D'
Question 15 has incorrect answer 'C', the correct answer is 'D'
12 questions were missed
The student failed
Sample run 2 (invalid student file)
Contents of cin:
invalidfile. txt
answers. txt
Here is the output to cout:
File "invalidfile. txt" could not be opened
Sample run 3 (invalid answer file)
Contents of cin:
student. txt
invalidfile. txt
Here is the output to cout:
File "invalidfile. txt" could not be opened
Sample run 4 (all answers valid)
Assume the student input file and the answers file both have the correct answers. The output to cout would be:
0 questions were missed
The student passed

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Now you’re on your own. include a short summary of this section with plots in your lab report. write a matlab script file to do steps (a) through (d) below. include a listing of the script file with your report. 1 the soundsc(xx,fs) function requires two arguments: the first one (xx) contains the vector of data to be played, the second argument (fs) is the sampling rate for playing the samples. in addition, soundsc(xx,fs) does automatic scaling and then calls sound(xx,fs) to actually play the signal. mcclellan, schafer, and yoder, dsp first, 2e, isbn 0-13-065562-7. prentice hall, upper saddle river, nj 07458. c 2015 pearson education, inc. 4 mcclellan, schafer and yoder, signal processing first. prentice hall, upper saddle river, new jersey, 2003. c 2003 prentice hall. (a) generate a time vector (tt) to cover a range of t that will exhibit approximately two cycles of the 4000 hz sinusoids defined in the next part, part (b). use a definition for tt similar to part 2.2(d). if we use t to denote the period of the sinusoids, define the starting time of the vector tt to be equal to t , and the ending time as ct . then the two cycles will include t d 0. finally, make sure that you have at least 25 samples per period of the sinusoidal wave. in other words, when you use the colon operator to define the time vector, make the increment small enough to generate 25 samples per period. (b) generate two 4000 hz sinusoids with arbitrary amplitude and time-shift. x1.t / d a1 cos.2
Answers: 1
question
Computers and Technology, 24.06.2019 03:00
Using a conditional expression, write a statement that increments numusers if updatedirection is 1, otherwise decrements numusers. ex: if numusers is 8 and updatedirection is 1, numusers becomes 9; if updatedirection is 0, numusers becomes 7.
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
Emma is using an artificial intelligence system, which contains information on botany, to identify a type of plant from an image. what type of ai is emma using?
Answers: 1
You know the right answer?
You will be creating a quiz grading program. You will compare the student's answers with the correct...
Questions
Questions on the website: 13722361