注册 登录
编程论坛 VC++/MFC

请教vc读取三维坐标问题

suchengjie 发布于 2013-06-09 15:30, 508 次点击
读取txt文件数据格式为:(共有将近10000行)
110.16359    24.43374    551
110.16442    24.43374    502
110.16192    24.43291    681
110.16275    24.43291    626
110.16359    24.43291    555
110.16442    24.43291    512
110.16525    24.43291    461
110.16109    24.43208    722
110.16192    24.43208    669
110.16275    24.43208    614
110.16359    24.43208    563
我先读取前十行的,代码如下:
#include <iostream>

#include <fstream>


int main()
{

    float a[10],b[10],c[10];   

    std::fstream fs("D:\\4560.txt");

    for (int i=0; i<10; i++)
    {

        fs >> a[i]>>b[i]>>c[i];
        std::cout << a[i] <<'  '<<b[i]<<'  '<<c[i]<< std::endl;
    }

    fs.close();   

    return 0;

}
结果显示是错误的,跟原来数据完全不一样
0 回复
1