-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsyntax.cpp
More file actions
38 lines (31 loc) · 776 Bytes
/
syntax.cpp
File metadata and controls
38 lines (31 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int>v = {3,4,4,9,9,6,27,8 };
//sort(v.begin(), v.end(), greater<int>());
//sorting vector increasing order
sort(v.begin(), v.end());
for(auto u: v){
cout<<u<<" ";
}
cout<<endl;
//sorting vector deccreasing order
sort(v.rbegin(), v.rend());
for(auto u: v){
cout<<u<<" ";
}
cout<<endl;
//reverse vector
reverse(v.begin(), v.end());
for(auto u: v){
cout<<u<<" ";
}
cout<<endl;
cout<<v.back()<<endl;
vector<int>::iterator it = max_element(v.begin(), v.end());
cout<<*it<<endl;
vector<int>::iterator i = min_element(v.begin(), v.end());
cout<<*i<<endl;
return 0;
}