1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Maslowich
3 years ago
12

Write a program that grades arithmetic quizzes as follows: Ask the user how many questions are in the quiz. Ask the user to ente

r the key (that is, the correct answers). There should be one answer for each question in the quiz, and each answer should be an integer. They can be entered on a single line, e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. You will need to store the key in an array. Ask the user to enter the answers for the quiz to be graded. As for the key, these can be entered on a single line. Again there needs to be one for each question. Note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. When the user has entered all of the answers to be graded, print the number correct and the percent correct.
Computers and Technology
1 answer:
kirill115 [55]3 years ago
7 0

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

int main(){

   int questions, answer;

   cout<<"Questions: ";

   cin>>questions;

   int answerkey[questions];

   cout<<"Enter answer keys: ";

   for(int i = 0; i< questions; i++){

       cin>>answerkey[i];    }

   int correct = 0;

   cout<<"Enter answers: ";

   for(int i = 0; i< questions; i++){

       cin>>answer;

       if(answer == answerkey[i]){

           correct++;        }    }

   cout<<"Correct answers: "<<correct<<endl;

   cout<<"Percentage correct : "<<(100 * correct)/questions<<"%";

   return 0;

}

Explanation:

This declares the number of questions and the answers submitted to each equation

   int questions, answer;

Prompt to get the number of questions

   cout<<"Questions: ";

This gets input for the number of questions

   cin>>questions;

This declares the answerkey as an array

   int answerkey[questions];

Prompt to get the answer key

   cout<<"Enter answer keys: ";

This iteration gets the answer key for each question

<em>    for(int i = 0; i< questions; i++){</em>

<em>        cin>>answerkey[i];    }</em>

This initializes the number of correct answers to 0

   int correct = 0;

Prompt to get the enter the answers

   cout<<"Enter answers: ";

This iterates through the answer keys

   for(int i = 0; i< questions; i++){

This gets the answer to each question

       cin>>answer;

This compares the answer to the answer key of the question

       if(answer == answerkey[i]){

If they are the same, correct is incremented by 1

           correct++;        }    }

Print the number of correct answers

   cout<<"Correct answers: "<<correct<<endl;

Print the percentage of correct answers

   cout<<"Percentage correct : "<<(100 * correct)/questions<<"%";

You might be interested in
A programmer is responsible for solving a problem and making a presentation that includes his solution. He does not have much ro
sashaice [31]

Probably 2 but that's just a guess.


5 0
3 years ago
Read 2 more answers
O A self-confident person knows that:
arlik [135]
C you should believe in yourself and your abilities
3 0
3 years ago
Find the simple interest Jay owes on a five-year student loan of $48,000 with an annual interest rate of 5%.
borishaifa [10]
Use the equation I=prt where interest = principal times rate times time.

Fill it out, it becomes I= 48000(.05)(5)

I= 12000
3 0
3 years ago
Which tcp/udp port does the dns service use to communicate?
denis23 [38]
Port 53

Man sometimes the answer minimum of 20 to explain is a bit unnecessary.
It's port 53 what else do you need to know?
7 0
3 years ago
Place the following eras of IT infrastructure evolution in order, from earliest to most recent: 1. Cloud Computing Era; 2. Clien
marshall27 [118]

Answer:

Personal Computer , Mainframe and Minicomputer , Enterprise Era , Client/Serve  , Cloud Computing Era

Explanation:

In most recent out of the given options , is the personal computer , followed by mainframe and minicomputer ,

where ,

Minicomputer - is the mid - range computer and is used small servers operating business and some scientific applications ,

Whereas , Mainframe is used , because of its higher processing power.

After mainframe and minicomputer is the Enterprise Era , and then followed by Client / server and the oldest one is the Cloud Computing Era.

7 0
3 years ago
Other questions:
  • What operator is used to create a validation rule? A. – B. / C. &lt; or &gt; D. +
    12·1 answer
  • Annie is a nutritionist. She is conducting seminars about following a healthy diet in various offices. Annie adds a picture of f
    14·2 answers
  • We want to construct a memory with 256 bytes in capacity. Assume that each byte has a unique address. (a) How many address lines
    14·1 answer
  • Explain how QoS might be implemented
    13·1 answer
  • Name the six parts of the product development life cycle.
    7·2 answers
  • Express 0.0005 x 10-4 farads as picofarads
    5·2 answers
  • Complete the statement below using the correct term.<br>Website managers use<br>every day​
    11·2 answers
  • Which of the following is not true?A. An organization may express its cybersecurity state through a Current Profile to report re
    10·1 answer
  • Simplest way to start baking career is to attend_______.<br><br><br><br>​
    9·1 answer
  • A market-product strategy that requires no change in the basic product but instead seeks new buyers is known as ______
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!