64,660
社区成员
发帖
与我相关
我的任务
分享
#include <string>
#include <vector>
#include <iostream>
using namespace std;
typedef struct edit
{
string strLabel;
string strText;
string strInfo;
int type;
int len;
bool must;
}stEdit;
int main()
{
string strName;
vector<stEdit> vedit;
//stEdit s={
stEdit s[]={{string("User Name:"),strName,string("len [1-20] letters/space"),0,20,1},
{string("User Name:"),strName,string("len [1-20] letters/space"),0,20,1},
};
int i;
for(i=0;i<2;++i)
vedit.push_back(s[i]);//有没有函数一次性push_back一个结构体数组?而不用一个一个push_back了
cout<<vedit.at(0).strLabel.c_str()<<endl;
return 1;
}
以上代码在vs2010正常,但在vc6就有错误.