Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Even software solutions has been requested by Eva Evenson, the towns local 2nd g

ID: 3759938 • Letter: E

Question

Even software solutions has been requested by Eva Evenson, the towns local 2nd grade teacher, to write a program that helps her grade the quizzes of her students. She asked that the program meet the following requirements:

1. Ask the user(her) how many questions are in the quiz.

2. Ask the user to enter 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. You will need to store the key in an array. We will only be using half of the these answers to grade the quizes.

3. Ask the user to enter the answers for the quiz to be graded.

4. Grade every other question from the first. Note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered.

5. When the user has entered all of the answers to be graded, print the number correct and the percent correct of those that were graded.

6. When this works, add a loop so that the user can grade any number of quizzes with a single key. After the results have been printed for each quiz, ask "Grade another quiz? (y/n)."

Explanation / Answer

#include<iostream.h>
#include<conio.h>

void main()
{
   char ch='y';
   int q, ans[100], key[100],i,c=0;

   while(ch=='y')
   {
       cout<<"Enter number of questions in quiz?";
       cin>>q;

       cout<<"Enter key for question";
       for(i=0;i<q;i++)
       {
           cin>>key[i];
       }


       for(i=0;i<q;i++)
       {
           cout<<"Enter Your answer for question "<<i+1;
           cin>>ans[i];
           if(key[i]==ans[i])
           {
               c++;
           }
       }

       cout<<"Number of correct answers are "<<c;
       cout<<" Grade another quiz? (y/n) ";
       ch=getch();
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote