Skip to content

Instantly share code, notes, and snippets.

@AlexTalker
Forked from anonymous/main.cpp
Last active August 29, 2015 14:02
Show Gist options
  • Save AlexTalker/b4cf0e0f01a0fcb82d71 to your computer and use it in GitHub Desktop.
Save AlexTalker/b4cf0e0f01a0fcb82d71 to your computer and use it in GitHub Desktop.
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