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
Why is Linux widespread in academic environments?
boyakko [2]
The answer will be... hmmm.. D?
8 0
2 years ago
What answer best explains why improper netiquette is considered dangerous? Individuals who violate user policies are often charg
adell [148]

Answer:

Students become vulnerable to cyberbullying and harassment.

Explanation:

3 0
3 years ago
Read 2 more answers
To execute a prepared SQL statement, you can use the ________________ and execute() methods of the PDOStatement object to set pa
svet-max [94.6K]

Answer:

The correct answer to the following question will be "bindValue".

Explanation:

  • The PDO declaration bind-value feature allows to bind a value or a function to a argument or a parameter.
  • To run a compensated statement of SQL, you could also use the PDOStatement object's bindvalue and execute() methods to set values of the paramenter or any argument and implement the comment.

Therefore, it's a right answer.

8 0
3 years ago
PLEASEEE HELPPPP me
insens350 [35]

Answer:

D

Hope This Helps!   Have A Nice Day!!

7 0
3 years ago
On the seventh day of the iteration, the team realizes that they will not complete 5 of the 13 stories. the product owner says s
nika2105 [10]

Answer:

First of all the team should excuse to the product owner for not being responsible and committed to the deadline.

Secondly, as they have completed the 8 stories, so they should revise and check the flaws in those stories and send to her.

Because when the product owner will check and happy with them, she will surely discuss the remaining stories with the team.

6 0
3 years ago
Other questions:
  • The score of a student in two subjects are inserted in the B2 and C2 cells and the passing score for each subject is 60. Which o
    13·1 answer
  • A snail goes up A feet during the day and falls B feet at night. How long does it take him to go up H feet? Given three integer
    8·1 answer
  • \Read the sentence.
    12·1 answer
  • Which two fields in an Ethernet frame help synchronize device communica- tions but are not counted toward the frame’s size?
    11·1 answer
  • Which device makes computers that are connected to separate segments appear and behave as if they're on the same segment? (Pleas
    11·1 answer
  • What best describes presentation software?
    14·1 answer
  • A digital designer might do computer animations for video games,<br> OA<br> True<br> OB<br> False
    12·2 answers
  • On the Format tab, which group allows you to select a different font for a chart?
    7·2 answers
  • You have imported a library with the birthMonth() function. Based on the API, how many strings are inputed to calculate the birt
    11·1 answer
  • KAPWING Video Editing Software allows you to use existing You Tube Videos in your design.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!