Write a C++ function to grade a multiple-choice exam. The exam has 20 questions, each answered with a letter in the range of 'a' through 'f'. The function should receive the data from the main program, process the request and send the output to the corresponding output file. The main program should read the data, which are stored on a file (exam.data) where the first line is the key, consisting of a string of 20 characters. The remaining lines on the file are exam answers, and consist of a student ID number, a space, and a string of 20 characters. The program should read the key, student ID, and each exam answer and send this data to the function, which should process the request and output the ID number and score to an output file (scores.out). Erroneous input should result in an error message. For example, given the data:
abcdefabcdefabcdefab
1234567 abcdefabcdefabcdefab
9876543 abddefbbbdefcbcdefac
5554446 abcdefabcdefabcdef
4445556 abcdefabcdefabcdefabcd
3332221 abcdefghijklmnopqrst
The program would output on scores.out file
1234567 20
9876543 15
5554446 Too few answers
4445556 Too many answers
3332221 Invalid answers