| 2.1.6.14 convert_tree_double_vector_to_str_vector
 DescriptionConvert double vector treenode to string vector.
 Syntaxint convert_tree_double_vector_to_str_vector( const TreeNode & trVec, vector<string> & vs, uint nSize, string strFmt = "*" ) 
 int convert_tree_double_vector_to_str_vector( const TreeNode & trVec, vector<string> & vs, const vector<int> & vnSignDigites = NULL ) Parameters trVec[input]source vector treenode to convert. vs[output]string vector for the result nSize[input]vs's size, if nSize > trVec.dVals.GetSize(), vs will size of trvec size. strFmt[input]format of convert double value, default is "*", mean show as system default setting, "*2" mean sets to display two significant digits. vnSignDigites[input] set each node double value convert significant digits.
 ReturnReturns the -1 when trVec not double vector. else return the size of vs.
 ExamplesEX1
 void test_convert_tree_double_vector_to_str_vector_ex1()
{
    Tree tr;
    vector    vd = {1,2,3,4.0989};
    tr.tr1.dVals = vd;
    vector<string> vs;
    int nRet = convert_tree_double_vector_to_str_vector(tr.tr1, vs, vd.GetSize(),"*3");    
    for(int nIndex =0 ; nIndex < vs.GetSize(); nIndex++)
        out_str(vs[nIndex]);//output 1.00, 2.00, 3.00, 4.10
}EX2
 void test_convert_tree_double_vector_to_str_vector_ex2()
{
    Tree tr;
    vector    vd = {1,2,3,4.0989};
    vector<int>    vsd = {1,2,3,4};
    tr.tr1.dVals = vd;
    vector<string> vs;
    int nRet = convert_tree_double_vector_to_str_vector(tr.tr1, vs, vsd);    
    for(int nIndex =0 ; nIndex < vs.GetSize(); nIndex++)
        out_str(vs[nIndex]);//output 1, 2.0, 3.00, 4.099
}RemarkSee AlsoHeader to Includeorigin.h
 Reference |