简单的c语言问题,用下标修改vector数值为什么会报错,请高人指点
typedefstruct{intGearBox;doublespeed;}ExamInfo;typedefvector<ExamInfo>InputTable;void...
typedef struct
{
int GearBox;
double speed;
}ExamInfo;
typedef vector<ExamInfo> InputTable;
void main()
{
InputTable InputData;
ExamInfo tmpInfo;
for (int j=0;j<10;j++)
{
tmpInfo.GearBox = j;
tmpInfo.speed = j;
InputData.push_back(tmpInfo);
}
InputData[8].GearBox = 111;
InputData[9].speed = 222;
}
InputData[8].GearBox = 111;
InputData[9].speed = 222;
用下标法修改容器的数值会报错,请问如何修改容器的数值呢,跪求高人指点。 展开
{
int GearBox;
double speed;
}ExamInfo;
typedef vector<ExamInfo> InputTable;
void main()
{
InputTable InputData;
ExamInfo tmpInfo;
for (int j=0;j<10;j++)
{
tmpInfo.GearBox = j;
tmpInfo.speed = j;
InputData.push_back(tmpInfo);
}
InputData[8].GearBox = 111;
InputData[9].speed = 222;
}
InputData[8].GearBox = 111;
InputData[9].speed = 222;
用下标法修改容器的数值会报错,请问如何修改容器的数值呢,跪求高人指点。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询