diff --git a/课设第二次.c b/课设第二次.c new file mode 100644 index 0000000..39f3d33 --- /dev/null +++ b/课设第二次.c @@ -0,0 +1,116 @@ +#include +#include +#include + +int question( int i) +{ + int a,b,j,m; + + for( i = i;i<100;i++ ) + { + loop: + { + a=rand()%51; + b=rand()%51;//rand()%100±íʾȡ50ÒÔÄÚµÄËæ»úÊý + + j=rand()%2;//jµÄÖµ¾ö¶¨¼Ó¼õ·¨ + } + if(j==0) + { + m=a+b; + if(m<=50) + { + printf("%d+%d=\n",a,b); + } + else + goto loop; + } + + else + { + m=a-b; + if(m<=50&&m>=0) + { + printf("%d-%d=\n",a,b); + } + else + goto loop; + + } + break; +} + return m; +} + +int main() +{ + int ordinal=1; + int modelanswer=0; + int studentanswer=0; + char str[20]; + int grade=0; + int n; + + + + printf("\n"); + printf("============================================================\n"); + printf("====================50ÒÔÄÚ¼Ó¼õ·¨¼ì²âϵͳ====================\n"); + printf("============================================================\n"); + printf("\n"); + + printf("ÇëÊäÈëÄãµÄÃû×Ö£º\n"); + scanf("%s",str); + printf("\nÄãºÃѽ£¬%sСÅóÓÑ£¬»¶Ó­½øÈë50ÒÔÄÚ¼Ó¼õ·¨¼ì²âϵͳ¡£\n",str); + printf("ÿµÀÌâÄãÓÐÈý´Î´ðÌâ»ú»á£¬Èç¹ûÈý´Î»ú»á½áÊøÔòÖ±½Ó¸ø³öÕýÈ·´ð°¸¡£\n"); + printf("\n²âÊÔ½áÊøºó»á¸ø³öÄãµÄ³É¼¨ÒÔ¼°ÏàÓ¦ÆÀ¼¶¡£\n"); + printf("\n"); + printf("======================ҪעÒâϸÐÄŶ~=========================\n\n"); + + for(n=1;n<11;n++) + { + printf("\nµÚ%dµÀÌ⣺\n",n); + modelanswer=question(n); + + printf("ÇëÊäÈë´ð°¸£º"); + scanf("%d",&studentanswer); + if(studentanswer==modelanswer) + { + printf("»Ø´ðÕýÈ·£¬Çë¼ÌÐø¼ÓÓÍŶ¡£\n"); + grade=grade+10; + } + else + { + printf("»Ø´ð´íÎó£¬ÇëºÃºÃ˼¿¼¡£Ä㻹ÓÐÁ½´Î»ú»á¡£\n"); + printf("ÇëÊäÈë´ð°¸£º"); + scanf("%d",&studentanswer); + + if(studentanswer==modelanswer) + { + printf("»Ø´ðÕýÈ·£¬Çë¼ÌÐø¼ÓÓÍŶ¡£\n"); + grade=grade+7; + } + + else + { + printf("»Ø´ð´íÎó£¬ÇëºÃºÃ˼¿¼¡£Ä㻹ÓÐÒ»´Î»ú»á¡£\n"); + printf("ÇëÊäÈë´ð°¸£º"); + scanf("%d",&studentanswer); + + if(studentanswer==modelanswer) + { + printf("»Ø´ðÕýÈ·£¬Çë¼ÌÐø¼ÓÓÍŶ¡£\n"); + grade=grade+5; + } + + else + { + printf("»Ø´ð´íÎó¡£ÕýÈ·´ð°¸ÊÇ£º%d\n",modelanswer); + grade=grade+0; + } + } + } + } + + return 0; +} \ No newline at end of file diff --git a/课设第二次.exe b/课设第二次.exe new file mode 100644 index 0000000..79755d0 Binary files /dev/null and b/课设第二次.exe differ