zoukankan      html  css  js  c++  java
  • 既可以支持整数四则运算,也可以支持分数四则运算,可定制出题数量的c语言程序

    #include<stdio.h>
    #include <stdlib.h>
    #include<conio.h>
    #include<time.h>
    #include<string.h>
    int main()
    {
        int a=0;
        int b=0;
        int c=0;
        int d=0;
        int m=0;
        int i,t,h,n,k,x,y;
        float r;
        scanf("%d",&n);
        srand((unsigned)time(NULL));
        for(i=0;i<n;i++)
        {
            a=rand()%100;
            b=rand()%100;
            c=rand()%100;
            d=rand()%100;
            m=rand()%8;
            if(a<b)
            {
                t=a;
                a=b;
                b=t;
            }
            if(c<d)
            {
                h=c;
                c=d;
                d=h;
            }
        switch(m)
        {
        case 0:
              printf("
    %d+%d=",a,b);break;
        case 1:
            printf("
    %d-%d=",a,b);break;
        case 2:
            printf("
    %d*%d=",a,b);break;
        case 3:
            printf("
    %d/%d=",a,b);break;
        case 4:
            {y=b*c+a*d;x=a*c;}
            printf("
    %d/%d+%d/%d=",a,b,c,d);break;
        case 5:
            {y=b*c-a*d;x=a*c;}
            printf("
    %d/%d-%d/%d=",a,b,c,d);break;
        case 6:
            {y=b*d;x=a*c;}
            printf("
    %d/%d*%d/%d=",a,b,c,d);break;
        case 7:
            {y=b*c;x=a*d;}
            printf("
    %d/%d/%d/%d=",a,b,c,d);break;
        default:
            printf("something is wrong!
    ");
            break;
        }
        printf("
    ");
        scanf("%d",&k);
      }
        return 0;
    }
  • 相关阅读:
    JVM 体系结构
    字符集和编码
    Thinking in Java 笔记
    HSDB
    jdb
    JVM-Class文件
    JVM-操作码助记符
    表、栈和队列
    算法分析
    Shell 编程
  • 原文地址:https://www.cnblogs.com/09-15/p/9765845.html
Copyright © 2011-2022 走看看