init_vector_string

 

Description

initialize a string array, set the size as nSize, the value of all strings as strDefault.

Syntax

void init_vector_string( vector<string> & vsEmptyVec, int nSize, string strDefault = "" )

Parameters

vsEmptyVec
[output] the string array to be initialized.
nSize
[input] the size for the vector.
strDefault
[input] the value for the strings.

Return

Examples

EX1

void init_vector_string_ex1()
{
    vector<string> vsEmptyVec(5);
    int nSize=4;
    string strDefault = "China";
    init_vector_string(vsEmptyVec, nSize, strDefault);
    for(int ii=0; ii<vsEmptyVec.GetSize(); ii++)
        printf("%s\n",vsEmptyVec[ii]);
    printf("end");
}

Remark

See Also

header to Include

origin.h

Reference