zoukankan      html  css  js  c++  java
  • 第一天

    今天是我使用博客的第一天!

    不久前刚刚接触了c++,感觉有点难于理解。尤其是各种函数和算法,真是搞得我头大,(其实是菜)。今天渣渣张涛怒刷几个简单题练练手(做作业),明天挑战一下递归和字符串,(这两部分学的不扎实)其实就是菜。

    下面是菜鸡代码,编着玩玩。

    oj1001

    #include<cstdio>
    using namespace std;
    int main()
    {
    float a,b;
    scanf("%f",&a);
    b=(a-32)*5/9;
    printf("%0.4f",b);
    return 0;
    }

    oj1002

    #include<cstdio>
    #include<cmath>
    using namespace std;
    int main()
    {
    float a,b,c,p,s;
    scanf("%f%f%f",&a,&b,&c);
    p=(a+b+c)/2;
    s=sqrt(p*(p-a)*(p-b)*(p-c));
    printf("%0.4f",s);
    return 0;
    }

    oj1003

    #include<iostream>
    using namespace std;
    int main()
    {
    int a,b,c;
    cin>>a;
    b=a*1000+a;
    c=b/7/11/13;
    cout<<c;
    return 0;
    }

    一本通1026

    #include<iostream>
    #include<cstdio>
    using namespace std;
    int main()
    {
    char a;
    int b;
    float c;
    double d;
    cin>>a>>b;
    scanf("%f %lf",&c,&d);
    cout<<a<<" "<<b<<" ";
    printf("%0.6f %0.6lf",c,d);
    }

    一本通1027

    #include<cstdio>
    using namespace std;
    int main()
    {
    double a;
    scanf("%lf",&a);
    printf("%lf %0.5lf %e %g ",a,a,a,a);
    return 0;
    }

    一本通1028(敲这么多cout累死了)

    #include<iostream>
    using namespace std;
    int main()
    {
    char a;
    cin>>a;
    cout<<" "<<" "<<a<<endl<<" "<<a<<a<<a<<endl<<a<<a<<a<<a<<a<<endl<<" "<<a<<a<<a<<endl<<" "<<" "<<a;
    return 0;
    }

    一本通1029

    #include<iostream>
    using namespace std;
    int main()
    { double a,b,r;
    cin>>a>>b;
    int k=a/b;
    r=a-(k*b);
    cout<<r;
    }

    一本通1030(为什么用double不明白,试出来的,用float系统显示有两个计算错误,shit!)

    #include<cstdio>
    using namespace std;
    int main()
    {
    double a,V;
    scanf("%lf",&a);
    V=a*a*a*3.14*4/3;
    printf("%0.2lf",V);
    return 0;
    }

    一本通1031

    #include<iostream>
    using namespace std;
    int main()
    {
    int a,b,c,d;
    cin>>a;
    b=a/100;
    c=a/10%10;
    d=a%10;
    cout<<d<<c<<b;
    return 0;
    }

    一本通1032(为了这个题,我渣渣差点摔键盘。一本通老是显示数据错误,代码和算法又没错,10分钟后才发现输入数据时候弄反了,cao,气死。)

    #include<cstdio>
    #include<iostream>
    using namespace std;
    int main()
    {
    float v,r,h;
    int n;
    scanf("%f%f",&h,&r);
    v=r/10*r/10*h/10*3.14;
    n=20/v;
    if (v<20)
    {
    n=n+1;
    cout<<n;

    else cout<<1;

    return 0;
    }

    一本通1033(两点距公式和海伦公式的计算也要用double,不然系统显示答案错误)

    #include<cstdio>
    #include<cmath>
    using namespace std;
    int main()
    {
    double x1,x2,y1,y2,l;
    scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
    l=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    printf("%0.3lf",l);
    return 0;
    }

    一本通1034(同上)

    #include<cstdio>
    #include<cmath>
    using namespace std;
    int main()
    {
    float x1,y1,x2,y2,x3,y3;
    double p,l1,l2,l3,s;
    scanf("%f%f%f%f%f%f",&x1,&y1,&x2,&y2,&x3,&y3);
    l1=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    l2=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
    l3=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    p=(l1+l2+l3)/2;
    s=sqrt(p*(p-l1)*(p-l2)*(p-l3));
    printf("%0.2lf",s);
    return 0;
    }

    渣渣加油,c++的海洋等你徜徉。

    最后献上人生中第一个代码,

    #include<iostream>
    using namespace std;
    int main()
    {
    cout<<"Hello,World!";
    return 0;
    }

    渣渣加油!


    else cout<<1;

    return 0;
    }

  • 相关阅读:
    Windows 8 常用快捷键
    An Simple Method for Sparse Matrix Optimization by GPU
    Loser’s “Bruteforced Cholesky Factorization for Sparse Matrix on CUDA”
    如何禁用CentOS6/RHEL6中的Nouveau驱动/How to Disable Nouveau Driver on CentOS6/RHEL6 before install NVIDIA Driver
    Car under Physical Sky
    Alembic for Mudbox
    Hair
    耳放一块
    I Like Red Hair, Definitely.
    Note for the Implemention of EnergyConserved Marschner Hair Reflectance Model
  • 原文地址:https://www.cnblogs.com/zaza-zt/p/12203754.html
Copyright © 2011-2022 走看看