Playground
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int a = min(3, 5); //a=3 int b = max(3, 5); //b=5 vector<int> v; for (int i=0; i<10; i++) { v.push_back((i*i*i)%10); } //v={0, 1, 8, 7, 4, 5, 6, 3, 2, 9} //min_element i max_element vrakjaat iteratori //shto znaci deka treba da napravime *(it) za da ja //dobieme vrednosta na najmaliot/najgolemiot element int c = *(min_element(v.begin(), v.end())); //c='0' int d = *(max_element(v.begin(), v.end())); //d='9' v.push_back(3); //v={0, 1, 8, 7, 4, 5, 6, 3, 2, 9, 3} int e = count(v.begin(), v.end(), 3); //e='2' vector<int>::iterator f; f = find(v.begin(), v.end(), 5); //*f = 5 v.clear(); for (int i=1; i<=3; i++) v.push_back(1); //v={1, 2, 3} vector<int> v2 = v; //v2={1, 2, 3} if (equal(v.begin(), v.end(), v2.begin())) //true cout << "ednakvi" << endl; //pechati 'ednakvi' return 0; }
Input data
Program output
no input
Execute
Language: ????????? | Memory: ???? KB | Time: ??? ms
Nothing has been executed, yet!