MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/vector-concepts/vector-comms.cpp:9–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#define endl '\n'
8
9int main(){
10 cin.tie(0)->sync_with_stdio(0);
11 /*
12 //setting the size of vector
13 vector<int> arr(5);
14 cout<<"the size of vector is :" <<arr.size();
15 */
16 /*
17 //initialising the vetor with the same value
18 vector<int> arr(5,21);
19 for (auto i : arr) {
20 cout<<i<<" ";
21 }
22 */
23 //if we add an extra element in the vector the size of that vector doubles
24 //using the find function ind vector
25 vector<int> arr={1,33,23,4,5,6};
26 int key;
27 cin>>key;
28 vector<int> ::iterator it= find(arr.begin(),arr.end(),key);
29 if(it!=arr.end()){
30 cout<<"preset at index "<<it-arr.begin();
31 }
32 else{
33 cout<<"not present"<<endl;
34 }
35
36 return 0;
37}
38
39

Callers

nothing calls this directly

Calls 1

findFunction · 0.50

Tested by

no test coverage detected