/* Open a file, copy its content to vector container and print.
Then sort the contents using 'sort()' and output to another file(date and time included). */
#include <iostream>
#include <string> // for class string
#include <fstream> // for file I/O
#include <vector> // for container vector
#include <algorithm> // for mthod sort()
using namespace std;
int main()
{
vector<string> vec;
string val;
ifstream infile("C:\\Users\\Desktop\\1.7.txt"); // pay attention to the description of escape sequence
if(!infile)
Then sort the contents using 'sort()' and output to another file(date and time included). */
#include <iostream>
#include <string> // for class string
#include <fstream> // for file I/O
#include <vector> // for container vector
#include <algorithm> // for mthod sort()
using namespace std;
int main()
{
vector<string> vec;
string val;
ifstream infile("C:\\Users\\Desktop\\1.7.txt"); // pay attention to the description of escape sequence
if(!infile)
cerr << "Oops! unable to open the file -- 1.7.txt.\n";
ofstream outfile("C:\\Users\\Desktop\\1.7.1.txt", ios_base::app); // path can be different
// 若不加后缀,则每次都会将原先内容覆盖
if(!outfile) //