函数功能:输入两个值,指定插值后数组长度,输出线性插值后的数组。
1 void test(double a, double b){
2 cout << "section: " << a << " " << b << endl;
3 const int INSERTPOINTNUMBER = 10;
4 double c[INSERTPOINTNUMBER] = {0.0};
5 for(int i = 0; i < INSERTPOINTNUMBER; ++i){
6 c[i] = (a * (INSERTPOINTNUMBER - i) + b * i) / float(INSERTPOINTNUMBER);
7 cout << c[i] << endl;
8 }
9 }
测试结果: