【发布时间】:2014-04-10 00:31:37
【问题描述】:
好的,这是我试图放入一个结构的变量,我有点担心我应该如何使用该结构实现并行数组。结构“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];
提前感谢所有帮助!
【问题讨论】:
-
“并行数组”是什么意思?
-
在 studentScores[NUM_STUDENTS][NUM_SCORES] 中的并行数组;我如何将它实现到结构中?使其成为结构中的数组,然后将结构的变量声明为数组?
-
“平行”是指“多维”吗?你的方法不正确吗?
-
不,这是我的代码和错误pastebin.com/GzPTb76h
标签: c++ arrays struct parallel-processing