c++考试内容程序设计

img

img

img

img

#include <iostream>

using namespace std;

int main()//第一题
{
    float x,y;
    scanf("%f",&x);

    if (x>10000)
        y=x*0.02;
    else if(x>5000)
        y=x*0.015;
    else if(x>3000)
        y=x*0.01;
    else if(x>0)
        y=x*0.005;
    else
        y=0.2;

    cout<<"每月应缴党费"<<y<<"元"<<endl;

    return 0;
}
#include <iostream>

using namespace std;

int main()//第二题
{
    int a[10],s=0,i;
    float v;
    for(i=0;i<10;i++)
    {
        scanf("%d",&a[i]);
        s+=a[i];
    }

    v=s/10.0;
    cout<<"平均分为"<<v;

    return 0;
}