Created
June 8, 2014 20:39
-
-
Save anonymous/185a678eefed239be53a 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 r=0; int m=0; | |
while(!in1.eof()) | |
{ | |
in1>>m; | |
mas.push_back(m); | |
r++; | |
} | |
in1.close(); | |
int x; | |
bool var; | |
cout<<"Please, type number. 0- Sorting ascending, 1- Sorting in decreasing order. \n"; | |
cin>>var; | |
if (var==0) {sort(mas.begin(), mas.end());} | |
else if (var==1) {sort(mas.end(), mas.begin());} | |
ofstream out1("out1.txt"); | |
for (vector<int>::iterator it=mas.begin(); it!=mas.end(); it++)cout<<" "<<*it; | |
return 0; | |
} |
Oh, use in line 10, but don't anything good.
Container vector have method size.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 5, unuser variable r.