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
You have invested millions of dollars for protecting your corporate network. You have the best IDS, firewall with strict rules a
Anna35 [415]

Answer:

Social Engineering

Explanation:

Even if you invest in the best possible security infrastructure for your corporate network, you will still be vulnerable to attacks which exploit human shortcomings. An example is where an attacker manipulates a company employee to get the system access password in return for a favour. Now he can use the password to bypass all security infrastructure and gain access to critical data and code.

4 0
3 years ago
How to check if students viewed an assignment canvas.
Greeley [361]
Which app are you using?
6 0
2 years ago
If a printer is not Wi-Fi capable, how can it be set up to provide the most reliable wireless printing
SCORPION-xisa [38]

Answer:

Well you can use bluetooth since it doesn’t require wifi and it would still work if your printing a file from your computer or your flash drive.

5 0
2 years ago
Read 2 more answers
7.3 A hydraulic lift has a mechanical advantage of 6. If the load weighs 780 N, calculate
Zielflug [23.3K]

Answer:

Effort = 120 Newton

Explanation:

Given the following data;

Mechanical advantage = 6

Load = 780 N

To find the effort required to lift the weight;

Mechanical advantage can be defined as the ratio of the load (weight) lifted by a simple machine to the effort (force) applied.

Mathematically, the mechanical advantage is given by the formula;

M.A = \frac {Load}{Effort}

Making effort the subject of formula;

Effort = \frac {Load}{M.A}

Substituting into the formula, we have;

Effort = \frac {720}{6}

Effort = 120 Newton.

3 0
3 years ago
How to know if someone read your message android?
vredina [299]
Is it on the actual messages or on an app???
4 0
3 years ago
Other questions:
  • The number of bits used to store color information about each pixel is called ____.
    13·1 answer
  • A person planning to file for bankruptcy must receive credit counseling within two years before filing the petition.
    7·1 answer
  • Discuss how and why video game hardware affects game design and where you think the next generation of platforms will change tho
    9·1 answer
  • A 30V battery maintains a current through a 10 Ω Resistor. What is the current flow through the resistor?
    6·1 answer
  • A program that contains the following method: public static void display(int arg1, double arg2, char arg3) { System.out.println(
    15·1 answer
  • Set screw compression and indenter are all types of
    13·2 answers
  • Hi wanna play fortnite tomorrow add me im batjoker09 no caps or spaces
    13·1 answer
  • write query for all products reutrn product name with its amounts due, paid, canceled, and refunded, order the result by product
    7·1 answer
  • List six features of the Microsoft ​
    10·1 answer
  • . Which of the following is NOT a
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!