c++

#include <iostream>
#include <cmath>
void max ()
{
    int a,b,c;
    std::cout << "输入三个数:" << std::endl;
    std::cin >> a >> b >> c;
    if (a>b&&a>c)
    {
        std::cout << a << std::endl;
    }
    else if(b>a&&b>c)
    {
        std::cout << b << std::endl;
    }
    else
    {
        std::cout << " " << c << std::endl;
    }
    system("pause");
}

void root()
{
    int a=0, b=0, c=0,x1,x2;
    std::cout << "输入三个数:a,b,c"<<std::endl;
    std::cin >> a >> b >> c;
    x1=(-b + sqrt(b*b - 4 * a*c)) / 2*a;
    x2 = (-b - sqrt(b*b-4*a*c)) / 2*a;
    std::cout << "x1="<<x1<<std::endl<<"x2="<<x2;
    system("pause");
}

void grade()
{
    double a;
    std::cout << "输入一个数:"<<std::endl;
    std::cin >> a;
    if (a>=80)
    {
        std::cout << "优秀";
    }
    if (a >= 70&&a<80)
    {
        std::cout << "良好";
    }
    if (a>=60&&a<70)
    {
        std::cout << "加油";
    }
    if(a<60)
    {
        std::cout << "不及格";
    }
    system("pause");
}
void triangle()
{
    double a, b, c;
    std::cin >> a >> b >> c;
    if (a + b < c)
    {
        std::cout << "不能组成三角形";
    }
    if (a+b>c)
    {
        std::cout << "能组成三角形";
    }
    system("pause");
}
void evaluation()
{
    int i=0, j, sum=0, max=0, min=0;    
    std::cout << "请输入20个数";
    std::cin >> i;
    max = i;
    min = i;
    sum += i;
    for (j=0;j<5;j++)
    {
        std::cin >> i;
        sum += i;
        if (i>max)
        {
            max = i;
        }
        if (i<min)
        {
            min = i;
        }
    }
    std::cout <<"最小值:"<< min<<"最大值:"<<max << "平均值:"<< (double)sum/20<<std::endl;    
}

void evaluation1()
{
    int i = 0, j, sum = 0, max=0, a=0;
    std::cin >> a;
    //std::cin >> i;
    //max = i;
    //sum += i; 
    for (j = 0; j<a; j++)
    {
        std::cin >> i;
        sum += i;
        if (i>max)
        {
            max = i;        
        }
        /*if (j == (a - 1))
        {
            break;
        }*/
    }
    std::cout << "最大值:" << max << "平均值:" << (double)sum / a << std::endl;
}

void evaluation2()
{
    int i = 0, j, sum = 0, max = 0, a = 0,b;
    std::cin >> a;
    while (1)
    {
        for (j = 0; j<a; j++)
        {
            std::cin >> i;
            sum += i;
            if (i>max)
            {
                max = i;
            }
        }
        std::cin >>b;
        if (b==-999)
        {
            break;
        }
    }
    std::cout << "最大值:" << max << "平均值:" << (double)sum / a << std::endl;
}

void increasing()
{
    int i;
    int num=0;
    for (i = 1; i < 101; i++)
    {
        num += i*i;
    }
    std::cout << num<<std::endl;
}
void king()
{
unsigned    long long i=0;
unsigned    long long sum = 0;
    for (int j = 0; j < 64; j++)
    {
        sum = sum + (unsigned   long long)2 >> j;
    }
    std::cout << sum-1 << std::endl;
}
void increasing1()
{
    int i,j=0;
    for (i = 1; i < 11; i++)
    {
        j += i;
    }
    std::cout << j << std::endl;
}
void main()
{
    //max();
    //root();
    //grade();
    //evaluation();
    //evaluation1();
    //evaluation2();
    //increasing();
    //increasing1();
    king();
    system("pause");
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值