数据结构如果txt文档里面存储的学生信息如下学号 姓名班级 课程1 分数1 课程2 分数2 学生之间的课程名称和
数据结构
如果txt文档里面存储的学生信息如下
学号 姓名 班级 课程1 分数1 课程2 分数2 ······
学生之间的课程名称和课程数量都不一样
要采用什么办法
使用C++通过学号 课程名称X检索到 课程X的分数啊??
[解决办法]
txt中可以这样存放:学号,班级,课程数目,课程1,分数1,课程2,分数2.........
struct Student
{
string num;
string name;
int cournum;//该学生的课程数
ListCoure *pCoures;//课程、分数链表
};
struct Course//课程
{
string name;
int score;
};
[解决办法]
[解决办法]
struct Student
{
string num;
string name;
int cournum;//该学生的课程数
ListCoure *pCoures;//课程、分数链表
struct Student *next;
};
struct Course//课程
{
string num;//此处改为num更合理。
int score;
struct Course * next;
};
[解决办法]
没学链表吗?就用上面的人所讲的方法
[解决办法]
项下
