Answered! i need help writing this in C++ code Write a program that scores a multiple choice test with 15 questions. (It doesn't matter what the questions are. Your…

i need help writing this in C++ code

Write a program that scores a multiple choice test with 15 questions. (It doesn’t matter what the questions are. Your program is grading the answer sheet or scantron card.) The correct answers are:

1.A

2.A

3.B

4.C

5.D

6.C

7.D

8.C

9.A

10.B

11.A

12.B

13.C

14.C

15.B

Store the correct answers to the questions in a character array of size 15. Let the user enter answers for each of the 15 questions and store the answers in a separate array of size 15. Your program should only accept A, B, C, D as answers. After the answers are entered, the program should tally up the total number of correctly answered questions, the total number of incorrectly answered questions and a list showing the questions that were answered incorrectly. The user passed the test if they answered at least 10 of the questions correctly. Print a message that says You passed if the user passed or You failed if the user failed the test

Expert Answer

 #include <iostream>

using namespace std;
int main() {
char a[15]={‘A’,’A’,’B’,’C’,’D’,’C’,’D’,’C’,’A’,’B’,’A’,’B’,’C’,’C’,’B’};//Array of characters to store the correct answers
char b[15];///Array of characters to store the user answers
int l[15];///Array of integers of max size 15 to store the list of wrong answers
//Taking user answers input
for(int i=0;i<15;i++)
{
cin>>b[i];
}
int ca=0,wa=0;//ca and wa variable keep track of no of correct and wrong answers respectively
for(int i=0;i<15;i++)
{
//if user answer matches with correct answer,then increase ca
if(a[i]==b[i])
ca++;
//if user answer does not match then increase wa and keep track of question no. in list i.e ‘l’ array
else if(a[i]!=b[i])
{
l[wa]=i+1;//Question no. is always one more than array index hence l is equated with i+1
wa++;

}
}
cout<<“No. of correct answersn”;
cout<<ca<<endl;
cout<<“No. of wrong answers n”;
cout<<wa<<endl;
cout<<“List of wrong answersn”;
for(int i=0;i<wa;i++)
{
cout<<l[i]<<” “;
}
if(ca>=10)
cout<<“nYou passed the test”;
else
cout<<“nYou failed the test”;
return 0;
}
Sample Input:A B C D A B C D A B C D A B C

Sample Output:

No. of correct answers
3
No. of wrong answers 
12
List of wrong answers
2  3  4  5  6  7  8  11  12  13  14  15  
You failed the test
Still stressed from student homework?
Get quality assistance from academic writers!