因此,我有使用STL列表的该程序:
#include "stdafx.h"
#include <iostream>
#include <list>
#include <algorithm>
using namespace std;
const int numberOfStudents = 3;
struct StudentInfo {
string name;
int grade;
};
void populateStudentRecords(list<StudentInfo>Students,list<int>::iterator iter){
}
int _tmain(int argc, _TCHAR* argv[])
{
list<StudentInfo>Records;
list<int>::iterator iter;
return 0;
}
我的问题是如何填充具有StudentInfo数据结构作为类型的列表,其中该结构具有字符串名称和整数等级?如何更改列表中结构的每个实例的这两个变量?
for (auto it = Records.begin(); it != Records.end(); ++it) {
it->name = ...
it->grade = ...
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句