Download presentation
Presentation is loading. Please wait.
1
STL Библиотека стандартных шаблонов
2
Алгоритмы sort for_each find count equal swap fill reverse
random_shuffle binary_search
3
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={2,6,5,8,4,9,1,0,3,7}; sort(t,t+size); for(int i=0; i<size; ++i) cout<<t[i]<<" "; }
4
#include <algorithm> #include <iostream> using namespace std; const int size=10; print(int x){ cout<<x<<" "; } int main(){ int t[size]={2,6,5,8,4,9,1,0,3,7}; sort(t,t+size); for_each(t,t+size,print);
5
#include <algorithm> #include <iostream> using namespace std; const int size=10; print(int x){ x*=2; cout<<x<<" "; } int main(){ int t[size]={2,6,5,8,4,9,1,0,3,7}; sort(t,t+size); for_each(t,t+size,print);
6
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={2,6,5,8,4,9,1,0,3,7}; cout<<find(t,t+size,0); }
7
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={2,6,5,8,4,9,1,0,3,7}; cout<<find(t,t+size,0)-t; }
8
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={2,6,5,8,4,9,1,0,3,7}; cout<<find(t,t+size,11)-t; }
9
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={1,1,1,2,2,1,1,3,3,0}; cout<<count(t,t+size,1); }
10
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={1,1,1,2,2,1,1,3,3,0}; int m[size]={1,1,1,2,2,1,1,3,3,0}; cout<<equal(t,t+size,m); }
11
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={1,1,1,2,2,1,1,3,3,0}; int m[size]={1,1,1,2,2,1,1,3,2,1}; cout<<equal(t,t+size,m); }
12
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]; fill(t,t+size,23); for(int i=0; i<size; ++i){ cout<<t[i]<<" "; }
13
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={1,2,3,4,5,6,7,8,9,10}; reverse(t,t+size); for(int i=0; i<size; ++i){ cout<<t[i]<<" "; }
14
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={1,2,3,4,5,6,7,8,9,10}; random_shuffle(t,t+size); for(int i=0; i<size; ++i){ cout<<t[i]<<" "; }
15
#include <algorithm> #include <iostream> using namespace std; const int size=10; int main(){ int t[size]={1,2,3,4,5,6,7,8,9,10}; cout<<binary_search(t,t+size,2); }
16
Контейнеры stack queue deque priority_queue list vector set multiset
map
17
STACK empty – стек пуст size – размер стека top – верхний элемент push – добавить элемент pop – удалить элемент
18
QUEUE empty – очередь пуста size – размер очереди front – верхний элемент push – добавить элемент pop – удалить элемент
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.