📜  c++ 初始化向量 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:52.633000             🧑  作者: Mango

代码示例2
// CPP program to create an empty vector
// and push values one by one.
#include 
using namespace std;

int main()
{
    int n = 3;

    // Create a vector of size n with
    // all values as 10.
    vector vect(n, 10);

    for (int x : vect)
        cout << x << " ";

    return 0;
}