-
-
Save AlexTalker/b4cf0e0f01a0fcb82d71 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
int main() | |
{ | |
ifstream in1("in1.txt"); | |
vector<int> mas; | |
int m=0; | |
while(!in1.eof()) | |
{ | |
in1>>m; | |
mas.push_back(m); | |
} | |
in1.close(); | |
int x; | |
bool var; | |
cout<<"Please, type number. 0- Sorting ascending, 1- Sorting in decreasing order. \n"; | |
cin>>var; | |
sort(mas.begin(), mas.end()); | |
if (var==1) {reverse(mas.begin(),mas.end());} | |
ofstream out1("out1.txt"); | |
for (vector<int>::iterator it=mas.begin(); it!=mas.end(); it++)cout<<" "<<*it; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment