BOJ 1st test

作者: cjs2019 | 来源:发表于2019-03-24 21:36 被阅读0次

    If you have certain questions, please try to solve it in the remark area. The writer is busy nowadays. And he has something important with……(you know……).

    只给最爱写文章,私信一律不回复。(

    QAQ

    感谢每一个曾经帮助过我的人……

    —————————我是分割线——————————

    本人真的太弱了,所以多次反复思考后,决定停更……

    (别每天就知道刷题,多花些时间陪一陪喜欢的人~~)

    侵删……

    —————————我是分割线——————————

    //纪念当年被大佬评价为shit一样的代码风格,

    // Every marvelous, spectacular and impressive painting begins with an empty canvas, even Rembrandt's.

    //BUT as is known to us all, "Genius is eternal patience." (Michelangelo)

    //(希望每一个小白,都能被温柔对待……

    —————————我是分割线——————————

    first test

    |A. 实验1_1_求两数的和与差 |

    代码:

    #include<stdio.h>
    #include<stdlib.h>
    int main(){
        int a,b;
        scanf("%d %d",&a,&b);
        printf("The sum is %d ",a+b);
        printf("and the difference is %d.",a-b);
    }
    

    | B. 实验1_2_基本类型数据的输入和输出 |

    代码:

    //关于命名问题,由于笔者一开始使用devcpp,后来转用clion,Xcode等,所以……希望大家能够理解吧……
    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
    //关于命名问题,由于笔者一开始使用devcpp,后来转用clion,Xcode等,所以……希望大家能够理解吧……
        char sex;
        int age;
        float height;
        scanf("%c",&sex);
        scanf("%d",&age);
        scanf("%f",&height);
        printf("The sex is %c",sex);
        printf(",the age is %d",age);
        printf(",and the height is %f.",height);
    }
    

    | C. 实验1_3_四则运算 |

    代码:

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
        double a,b,c,d,x;
        scanf("%lf",&a);
        scanf("%lf",&b);
        scanf("%lf",&c);
        scanf("%lf",&d);
        x=(a+b)*(a-b)+c/d;
        printf("%lf",x);
        return 0;
    }
    

    D. 实验1_4_求圆的周长与面积

    代码:

    #include<stdio.h>
    #include<stdlib.h>
    #define PI 3.14159265
    int main()
    {
        double R;
        double perimeter;
        double area;
        scanf("%lf",&R);
        perimeter=2*PI*R;
        area=PI*R*R;
        printf("The perimeter is %.4lf",perimeter);
        printf(", the area is %.4lf.",area);
        return 0;
    }
    

    | E. 实验1_5_数据类型 |

    代码:

    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
        char a;
        short b;
        int c;
        long d;
        long long e;
        float f;
        double g;
        scanf("%c%hd%d%ld%lld%f%lg",&a,&b,&c,&d,&e,&f,&g);
        printf("The 'char' variable is %c, "
               "it takes %d byte.\n"
               "The 'short' variable is %hd, it takes %d bytes.\n"
               "The 'int' variable is %d, it takes %d bytes.\n"
               "The 'long' variable is %ld, it takes %d bytes.\n"
               "The 'long long' variable is %lld, it takes %d bytes.\n"
               "The 'float' variable is %f, it takes %d bytes.\n"
               "The 'double' variable is %lf, it takes %d bytes.\n",a,sizeof(a),b,sizeof(b),c,sizeof(c),d,sizeof(d),e,sizeof(e),f,sizeof(f),g,sizeof(g));
    }
    

    2nd test

    | A. 实验2_1_判断两数的大小 |

    话说有人来投稿吗?

    相关文章

      网友评论

        本文标题:BOJ 1st test

        本文链接:https://www.haomeiwen.com/subject/nfxsvqtx.html