Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

  1. C++
  2. for
  3. if
  4. variable
  5. function
  6. return
  7. array
  8. void
  9. reference
  10. main
  11. prototype

Name your program pass1.cpp. Your program should meet the following requirements

  1. Define a function that can read the input file answers.dat. This function should not print anything.
  2. 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.
  3. 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.

  1. The main() function should create the necessary variables and use the three functions above. The main() function should not print anything.
  2. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Database Technology Edbt 88 International Conference On Extending Database Technology Venice Italy March 14 18 1988 Proceedings Lncs 303

Authors: Joachim W. Schmidt ,Stefano Ceri ,Michele Missikoff

1988th Edition

3540190740, 978-3540190745

More Books

Students also viewed these Databases questions