Created
August 12, 2013 14:53
-
-
Save anonymous/6211515 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 <string> | |
#include <fstream> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int main() | |
{ | |
vector<string> text_file; | |
ifstream ifs( "file1.txt" ); | |
string temp; | |
//Henter en linje, legger den inn i vektoren. | |
while( getline( ifs, temp ) ) | |
text_file.push_back( temp ); | |
//Sorterer vektoren | |
sort(text_file.begin(), text_file.end()); | |
//Skriver ut vektoren. | |
for (int i=0; i < text_file.size(); i++){ | |
cout << text_file[i] << endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment