请问如何将头文件[C]按照长尾词进行排序?
- 内容介绍
- 文章标签
- 相关推荐
本文共计117个文字,预计阅读时间需要1分钟。
cppusing namespace std;using namespace std::placeholders;
bool comP(string a, string b) { return a + b; }
int main() { ofstream of; of.open(headfile.h); ifstream ifile(head_file.h); vector head; string v; while (getline(ifile, v)) { // 处理文件内容 } return 0;}
using namespace std; using namespace std::placeholders; bool comP(string &a, string& b) { return a < b; } int main() { ofstream of; of.open("headfile.h"); ifstream ifile("head_file.h"); vector<string> head; string v; while (getline(ifile, v)) { head.push_back(v); } sort(head.begin(), head.end(), comP); for (auto & h : head) of << h << endl; return 0; }
本文共计117个文字,预计阅读时间需要1分钟。
cppusing namespace std;using namespace std::placeholders;
bool comP(string a, string b) { return a + b; }
int main() { ofstream of; of.open(headfile.h); ifstream ifile(head_file.h); vector head; string v; while (getline(ifile, v)) { // 处理文件内容 } return 0;}
using namespace std; using namespace std::placeholders; bool comP(string &a, string& b) { return a < b; } int main() { ofstream of; of.open("headfile.h"); ifstream ifile("head_file.h"); vector<string> head; string v; while (getline(ifile, v)) { head.push_back(v); } sort(head.begin(), head.end(), comP); for (auto & h : head) of << h << endl; return 0; }

![请问如何将头文件[C]按照长尾词进行排序?](/imgrand/n2N4kS2S.webp)