Question
This is subject of C++ Your program should read the file answers.dat . This file contains the name of the student who took the quiz,
This is subject of C++ Your program should read the file answers.dat. This file contains the name of the student who took the quiz, and his answers for each question. The answers file has the following format:
- The student name is always the first line.
- A student name may or may not have last names. For example, both Elvis Presley and Cher took this class.
- A quiz always has 11 questions.
- There is one answer per line. Each answer is one word and all lowercase.
The correct answers to the quiz questions were:
- C++
- for
- if
- variable
- function
- return
- array
- void
- reference
- main
- prototype
Name your program pass1.cpp. Your program should meet the following requirements
- Define a function that can read the input file answers.dat. This function should not print anything.
- Define a function that computes the quiz score of the function by comparing the correct answers to the students answer. The result should be a percentage between 0 and 100, not a value between 0 and 1. This function should not print anything.
- Define a function that prints the report as shown in the sample run below. The report format should be exactly the same: alignment, numbers after decimal points, and so on. For incorrect answers, print INCORRECT as shown next to the wrong answers.
The only change is that your name should be printed as the top label to indicate you were the developer.
- The main() function should create the necessary variables and use the three functions above. The main() function should not print anything.
- You must include a comment at the top of your .cpp file in this format:
/*******************
Pat Programmer
CSCI 2010 Section 03
Assignment 1
Programmed on Windows 7, Visual C++
This program does
*******************/
You should obviously change the name to your name, the section to your section, the system to the system you used, and write a real description of the program
NOTE: You should not use pointers in this assignment. It is a review from last semester.
Sample Run
Suppose you have an answers.dat with these contents:
Elvis Presley
C++
for
if
variable
function
cheese
array
robots
reference
main
prototype
When you run your program, the output would be:
!!! Pat Programmers Most Excellent Quiz Reporter !!!
Report for Elvis Presley
CORRECT ANS STUDENT ANS
C++ C++
for for
if if
variable variable
function function
return cheese INCORRECT
array array
void robots INCORRECT
reference reference
main main
prototype prototype
QUIZ SCORE
81.82%
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