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

编写一下这个几个程序,不用标写注释,每个程序前面都要标清楚题号5.6~5.8 以及8.1 8.5和8.6

img

img

img

5.6

#include <iostream>

using namespace std;

float scanner() {
    float x;
    cin >> x;
    return x;
}
float p(int n, float x) {
    if (n == 0) {
        return 1;
    }
    if (n == 1) {
        return x;
    }
    if (n > 1) {
        return ((2 * n - 1)* x - p(n - 1, x) - (n - 1)*p(n - 2, x)) / n;
    }
}

int main(){
    int n;
    float x;
    cout << "输入n:" << endl;
    cin >> n;
    cout << "输入x;" << endl;
    cin >> x;
    x = scanner();
    cout << "结果:" << p(n, x) << endl;
}


建议你看下这篇博客详解C++的编译过程

参考一下: