#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream in("/home/qz/Desktop/Amos.txt");
ofstream out("/home/qz/Desktop/Amos2.txt");
string filename;
string line;
if (in) // 有该文件
{
while (getline(in, line)) // line中不包括每行的换行符
{
//cout << line.length() << endl;
if(line.length() < 30 && line.length() > 5 && line.c_str()[0]<='9'&&line.c_str()[0]>='1')
//if(line.length() < 30 && line.length() > 5)
{
cout << line;
out << line << endl; // 输入到2.txt中
}
}
}
else // 没有该文件
{
cout << "no such file" << endl;
}
return 0;
}