1.
//test.h #include <string> using namespace std; struct AA { string a1; string a2; string a3; }; class test { public: void ReadString(vector<AA> vv); };
#include "StdAfx.h" #include "test.h" void test::ReadString(vector<AA> vv) { vector<AA>::iterator it; for (it=vv.begin();it!=vv.end();++it) { string ss=it->a1; } }
void CtttttttDlg::OnBnClickedButton1() { // TODO: Add your control notification handler code here AA aa1; aa1.a1="aaaa11"; aa1.a2="aaaa12"; aa1.a3="aaa13"; AA aa2; aa2.a1="aaaa21"; aa2.a2="aaaa22"; aa2.a3="aaa23"; vector<AA> vv; vv.push_back(aa1); vv.push_back(aa2); /*vector<AA>::iterator it; for (it=vv.begin();it!=vv.end();++it) { string ss=it->a1; } */ test ts; ts.ReadString(vv); }
时间: 2024-10-10 07:28:59