At Westonci.ca, we make it easy to get the answers you need from a community of informed and experienced contributors. Connect with a community of experts ready to provide precise solutions to your questions quickly and accurately. Experience the ease of finding precise answers to your questions from a knowledgeable community of experts.
Sagot :
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
for(int i = 0; i< questions; i++){
cin>>answerkey[i]; }
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<<"%";
Thanks for using our platform. We're always here to provide accurate and up-to-date answers to all your queries. Thank you for your visit. We're committed to providing you with the best information available. Return anytime for more. We're glad you visited Westonci.ca. Return anytime for updated answers from our knowledgeable team.
Which word correctly completes the sentence? All around the attic we found many __________ nests. A.