优艾设计网

c++怎么判断20道选择题的对错? 财富值79?

优艾设计网 https://www.uibq.com 2023-04-22 16:45 出处:网络 作者:PS教程自学
write a program to grade a multiple-choice exam. The exam has 20 questions, each answered with a letter in the range of ‘a’ through ‘f’.The program should read the key from input, then read each a

write a program to grade a multiple-choice exam. The exam has 20 questions, each answered with a letter in the range of ‘a’ through ‘f’.
The program should read the key from input, then read each answer and output the ID number and score. Erroneous input should result in a error message.
Input
The first line of input is the key, consisting of a string of 20 characters.
The remaining lines are exam answers, each of which consists of a student ID number, a space, and a string of characters.
The input ends with 0.
Output
Output the score for each ID number in a sigle line, consisting the ID number, a space, and the score or error message.
Sample Input
Copy sample input to clipboard
abcdefabcdefabcdefab
1234567 abcdefabcdefabcdefab
9876543 abddefbbbdefcbcdefac
5554446 abcdefabcdefabcdef
4445556 abcdefabcdefabcdefabcd
3332221 abcdefghijklmnopqrst
0
Sample Output
1234567 20
9876543 15
5554446 Too few answers
4445556 Too many answers
3332221 Inva优艾设计网_设计LOGOlid answers


0

精彩评论

暂无评论...
验证码 换一张
取 消