编制一个程序,完成100以内的整数加减法自动出题和评分系统.

1个回答

  • #include

    #include

    #include

    int a[10]={0},len=0;

    int produce_question(){

    x05int x,y,z;

    x05srand((unsigned)time(NULL));

    x05while(1){

    x05x05x = rand()%100+1;

    x05x05y = rand()%100+1;

    x05x05z = rand()%2;

    x05x05if(z == 0){

    x05x05x05printf("%d + %d =",x,y);

    x05x05x05return x+y;

    x05x05}else{

    x05x05x05if(x>=y){

    x05x05x05x05printf("%d - %d =",x,y);

    x05x05x05x05return x-y;

    x05x05x05}

    x05x05}

    x05}

    }

    int judge(int n){

    x05int x;

    x05scanf("%d",&x);

    x05if(n==x){

    x05x05printf("Correct!n");

    x05x05return 1;

    x05}

    x05else {

    x05x05printf("The right answer is :%dn",n);

    x05x05return 0;

    x05}

    }

    int main()

    {

    x05 int temp,res;

    x05 while(1){

    x05x05 while(len