关于C++的问题,需要编译

编写一下这个几个程序,不用标写注释,每个程序前面都要标清楚题号 3.1~3.6

img

img

img

3.1
(1)

    int m = 2.5;
    float k;
    double x;
    k = sqrt(pow(sin(x),m));

(2)

    double x,a;
    float k;
    k = (a*x + (a + x) / (4 * a)) * 1 / 2;

(3)

    int n = 2;
    double x,c;
    float k;
    const double PI = atan(1.)*4.;
    k = (pow(c,pow(x,n)))/sqrt(2*PI)

3.2
(1)
14.2

(2)
2.5

(3)
2,5,9


3.3
(1)
a1 = 1 a2 = 1

(2)
1,1

(3)
2,0,0
(4)
20


3.4

#include <iostream>

using namespace std;

int main(){
    int x, y;
    cin >> x;
    if (x <= -1)
        y = x - 1;
    else if (x < 2)
        y = 2 * x;
    else if (x <= 10)
        y = x * (x + 2);
    cout << y << endl;
    return 0;

}


3.5

#include <iostream>

using namespace std;

int main(){
    int temp;
    cout << "输入一个数字:" << endl;
    while (cin >> temp)
    {
        int k = (temp % 3 == 0) + (temp % 5 == 0) + (temp % 7 == 0) * 4;
        switch(k)
        {
        case 0:cout << "不能被3,5,7任一个整除" << endl; break;
        case 1:cout << "能被3整除" << endl; break;
        case 2:cout << "能被5整除" << endl; break;
        case 3:cout << "能被3,5整除" << endl; break;
        case 4:cout << "能被7整除" << endl; break;
        case 5:cout << "能被3,7整除" << endl; break;
        case 6:cout << "能被5,7整除" << endl; break;
        case 7:cout << "能同时被3,5,7整除" << endl; break;
        }
        cout << "输入一个数字:" << endl;
    }

}


3.6


#include <iostream>

using namespace std;

int main(){
    int a;
    cout << "输入成绩:" << endl;
    cin >> a;
    if (a >= 90) {
        cout << "A" << endl;
    }
    else if (a >= 80 && a <= 89) {
        cout << "B" << endl;
    }
    else if (a >= 70 && a <= 79) {
        cout << "C" << endl;
    }
    else if (a >= 60 && a <= 69) {
        cout << "D" << endl;
    }
    else {
        cout << "E" << endl;
    }
    return 0;
}