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,
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; }