[英]parallel arrays and structs? C++
好的,这是我要放入一个结构中的变量,我有点担心如何使用该结构实现并行数组。 结构“ studentType”正确吗?
const int NUM_STUDENTS = 10; //global variables
const int NUM_SCORES = 5;
string studentNames[NUM_STUDENTS], letterGrades[NUM_STUDENTS]; //old program variables
float studentAverages[NUM_STUDENTS];
int studentScores[NUM_STUDENTS][NUM_SCORES];
struct studentType{
string name;
string grade;
float average;
int scores[NUM_SCORES];
};
studentType student[NUM_STUDENTS];
我非常感谢所有的帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.