how to iterate trough a vector in c++

C++
vector<int> myVector;

myVector.push_back(1);
myVector.push_back(2);
myVector.push_back(3);
myVector.push_back(4);

for(auto x: myVector){
	cout<< x << " ";

}

vector<pair<int,int>> myVectorOfPairs;

myVectorOfPairs.push_back({1,2});
myVectorOfPairs.push_back({3,4});
myVectorOfPairs.push_back({5,6});
myVectorOfPairs.push_back({7,8});

for(auto x: myVectorOfPairs){
	cout<< x.first << " " << x.second << endl;

}







Source

Also in C++: