下面有一个题目和要求,请帮忙用C语言编写一下,The following is a student’s home work STANDARD solution.2 A 4 D 6 D 8 C 10 A 12 D 14 C 16B 18 A 20 C 22 C 24A 26 A 28 B 30 D 32 A 34 B 36C 38C 40B42D 44 D 46 A 48C 50 A 52D 54A 56D 58
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 09:09:12
下面有一个题目和要求,请帮忙用C语言编写一下,The following is a student’s home work STANDARD solution.2 A 4 D 6 D 8 C 10 A 12 D 14 C 16B 18 A 20 C 22 C 24A 26 A 28 B 30 D 32 A 34 B 36C 38C 40B42D 44 D 46 A 48C 50 A 52D 54A 56D 58
下面有一个题目和要求,请帮忙用C语言编写一下,
The following is a student’s home work STANDARD solution.
2 A 4 D 6 D 8 C 10 A 12 D 14 C 16B 18 A 20 C 22 C 24A 26 A 28 B 30 D 32 A 34 B 36C 38C 40B
42D 44 D 46 A 48C 50 A 52D 54A 56D 58 B 60 A 62D 64C 66C 68C 70B 72A 74D 76A 78D 80D
One student got answer:2.A 4D 6D 8C 10A 12.,A 14B 16D 18A 20,C 22C 24A
26A 28B 30D 32;A 34B 36’C 38C 40B 42D 44A 46A 48A 50)A 52C 54)C 56D 58B 60D
62C 64C 66C 68C 70]B 72A 74D 76}C 78C 80D
Here ‘s ,} ] ) ; ‘ .,not part of answer.
Try to write a c program to find how many points the student being earned and print it out.
Importance:your input must be same as above (student answer) exactly.
下面有一个题目和要求,请帮忙用C语言编写一下,The following is a student’s home work STANDARD solution.2 A 4 D 6 D 8 C 10 A 12 D 14 C 16B 18 A 20 C 22 C 24A 26 A 28 B 30 D 32 A 34 B 36C 38C 40B42D 44 D 46 A 48C 50 A 52D 54A 56D 58
#include
#include
void main()
{ char STANDARD[400]="2 A 4 D 6 D 8 C 10 A 12 D 14 C 16B 18 A 20 C 22 C 24A 26 A 28 B 30 D 32 A 34 B 36C 38C 40B42D 44 D 46 A 48C 50 A 52D 54A 56D 58 B 60 A 62D 64C 66C 68C 70B 72A 74D 76A 78D 80D";
char stu_ans[400]="2.A 4D 6D 8C 10A 12.,A 14B 16D 18A 20,C 22C 24A26A 28B 30D 32;A 34B 36’C 38C 40B 42D 44A 46A 48A 50)A 52C 54)C 56D 58B 60D62C 64C 66C 68C 70]B 72A 74D 76}C 78C 80D";
//注意字符数组不分行,要分行加上字符'\'且下一行第一个字符不能为空格!
int i,j,sum=0;
for(i=0,j=0;STANDARD[i]!='\0'&&stu_ans[j]!='\0';)
{
if(STANDARD[i]68)
{
i++;continue;
} //不是A~D的跳过
if(stu_ans[j]68)
{
j++;continue;
} //不是A~D的跳过
if(STANDARD[i]==stu_ans[j])
sum++;
i++;
j++;
}
printf("The points which the student earn is %d\n",sum);
}