#include#include int main() { // create an empty QVector of type int QVector vec; // add some elements to the vector using push_back method vec.push_back(10); vec.push_back(20); vec.push_back(30); // print the elements of the vector using QVector::operator[] for (int i = 0; i < vec.size(); ++i) { std::cout << vec[i] << " "; } return 0; }
10 20 30
#include#include #include int main() { // create an empty QVector of type QString QVector vec; // add some elements to the vector using push_back method vec.push_back("Hello"); vec.push_back("World"); vec.push_back("!"); // print the elements of the vector using QVector::at method for (int i = 0; i < vec.size(); ++i) { std::cout << vec.at(i).toStdString() << " "; } return 0; }
Hello World !Package Library: The package library for QVector is the Qt C++ library. It is a cross-platform application development framework that includes modules for GUI development, networking, threading, and more. The QVector container class is included in the QtCore module of the Qt library.