c++std vector three elemet c++
// C++ program to store data triplet in a vector // using user defined structure. #include<bits/stdc++.h> using namespace std; struct Test { int x, y, z; }; int main() { // Creating a vector of Test vector<Test> myvec; // Inserting elements into vector. First // value is assigned to x, second to y // and third to z. myvec.push_back({2, 31, 102}); myvec.push_back({5, 23, 114}); myvec.push_back({9, 10, 158}); int s = myvec.size(); for (int i=0;i<s;i++) { // Accessing structure members using their // names. cout << myvec[i].x << ", " << myvec[i].y << ", " << myvec[i].z << endl; } return 0; }