Created
September 10, 2015 21:05
-
-
Save residentkrm/0ce252179f61fe81a376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <vector> | |
#include <algorithm> | |
#include <string> | |
#include <conio.h> | |
using namespace std; | |
int main(int argc, char *argv[]) { | |
string x = "This is C++."; | |
ofstream of("d:/tester.txt"); | |
of << x << endl; | |
of << x << "2"; | |
of.close(); | |
vector<string> list; | |
ifstream in_stream; | |
string line; | |
in_stream.open("d:/tester.txt"); | |
int count = 0; | |
while (!in_stream.eof()) | |
{ | |
++count; | |
std::getline(in_stream, line); | |
list.push_back(line); | |
cout << count << " " << line << endl; | |
} | |
in_stream.close(); | |
sort(list.begin(), list.end()); | |
_getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment