C++生成DM数据点导入DM

c++编写正弦曲线点的代码,源代码如下:

//想要使用内置的π,此句必不可少!

#define _USE_MATH_DEFINES    

#include<iostream>

#include<fstream>

#include<cmath>

 

using namespace std;

 

int main()

{

    ofstream out("1.txt");

    

    const double width = 2 * M_PI;    //输出x坐标为0~2π

    double x = 0;    //x坐标

    double y = 0;    //y坐标

    

    

    

    

    

    for (int i = 0; i < 100; i++)    

    {

        x = i*(width / 100);

        y = sin(x);

        out << "1 " << i + 1 << " " << x << " " << y << " " << "0" << endl;

    }

    return 0;

}

我们先运行一次程序,生成我们含有我们需要数据点的文件

注:当然也可以用其他软件生成数据点,完成自己需要的模型即可!

posted @ 2016-04-12 20:50  硫酸亚铜  阅读(324)  评论(0编辑  收藏  举报