64,688
社区成员
发帖
与我相关
我的任务
分享
print [x.split()[2] for x in open('txt')]
awk '{print $3}' txt
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
int main()
{
int col=3;
fstream f("txt");
string line;
vector <string> words;
while (getline(f, line)) {
stringstream in(line);
string sel;
for (int i=0; i<col; i++)
in >> sel;
words.push_back(sel);
}
for (int i=0; i<words.size(); i++)
cout << words[i] << endl;
}
ifstream in("xx.txt");
for(string str; getline(in,str);)