#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void main()
{
char buffer[255];
long double j;
int t;
string t1, t2;
fstream out;
out.open("rpts.txt", ios::in);
cout << "rpts.txt" << " 的内容如下:" << endl;
while (!out.eof())
{
out.getline(buffer, 256, '\n');//getline(char *,int,char) 表示该行字符达到256个或遇到换行就结束
cout << buffer << endl;
t1.assign(buffer); //将buffer字符串赋给t1
int loc = t1.find('\t',0); //从头查找空格符,返回空格符的位置
t = t1.length();
t2 = t1.substr(0, loc); //将t1的[0]~[loc]的数据复制给t2
j =atof(t2.c_str()) ; //将t2的字符转换为数据
if(j != 0)
cout << j << endl;
t2 = t1.substr(loc+1, t-loc);
j = atof(t2.c_str());
if (j != 0)
cout << j << endl;
}
out.close();
cin.get();//cin.get() 是用来读取回车键的,如果没这一行,输出的结果一闪就消失了