Please help me with this one!
This is what should look like:
The local Driver's License Office has asked you to write a program that grades the written portion of the drivers license exam. The exam has 20 multiple choice questions, each with letter answers from 'A' to 'D'. Make sure to only allow input values of 'A' - 'D'. Your program should store the correct answers in the text file in an array. It should then ask the user to type in the students answers for each of the 20 questions, and the answers should be stored in a second array. After the students answers have been entered, the program should display a message indicating if the person passed or failed the exam, given that it takes 15 or more correct answers to get a passing grade. You will want to save the in the same directory as the cpp file that you are using. To be clear: 1. Open the file Data. and read the 20 character values into an array. 2. Close the data file. 3. Ask the user for their 20 answers to questions 1-20. 1. Make sure each answer is between 'A' and 'D' 2. While the array uses 0 - 19, make sure the questions ask for 1 - 20. 4. Compare the two arrays to see how many match. 1. Use a function for this. 2. The function Declaration should be int scoreExam(char key, char answers, int size). 5. Tell the user whether they passed or failed depending on if they got 15 or more correct.cout > answer; studentans [1] = answer; score = scoreExam (correctans [size], studentans [size], size); // Funtion Hint scoreExam (char key , char answers , int size) int i = 0, correctanswers = 0; for (i = 0; i > correctans[i]; datafile.close(); // Ask for students' answers for (i = 0; i > answer; while (answer != 'A' && answer != 'B' && answer != 'C' && answer != 'D' ) { cout > answer; studentans [i] = answer; score = scoreExam(correctans [size], studen Studentans [size], size);#include
#include #include using namespace std; // Prototype int scoreExam(char key, char answers, int size); lint main() const int size = 20; const int correctneed = 15; int i = 0, score; char correctans [size], studentans [size], answer; // Open the file and take out the data ifstream datafile: datafile. open( .nata "); if (!datafile) cout > correctans[i]; datafile.close(); // Ask for students' answers for (i = 0; i > answer; while (answer != 'A' & answer != 'B' && answer != 'C' && answer != 'D') cout >