问题还没有解决。。。[请看到的老师们 帮忙看看,谢谢,麻烦了]
等待中~
我大概的想法是用结构体嵌套,
嗯~ 打个比喻, 班上每个同学的学号是外结构体的数据, 之后用学号来找同学。
每个同学的各科成绩是内结构体。
我现在想做一个同学个各科成绩录入, 可是在科目一 链接 科目二 在这儿错了,
图中是DeV C++ 编译软件
而VC++ 报错是:E:\C\GG\GGGG.CPP(42) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'struct date *' (or there is no acceptable conversion)
如果把图中阴影部分改为: head->full = * front; 则不报错。
希望老师们 说下如何解决, 以及为何该为 head->full = * front; 之后不报错,却会终止程序,[ 其中的问题是什么 ]
刚刚创建的CSDN账号,没有财富值,-。-
老师, 不怎么会动态分配 啊。。。
typedef struct date{
int prestoreboole; // 1/0 进行位与运算;与grade中boole 相同;
int cut; // 代表时候被删掉,1代表删掉,0代表不被删掉。
struct date *neinext; // 内表中的指针域
}Date,*linklist;
typedef struct grade{
int boole;
int number;
double result;
struct date *full;
struct grade *next;
}Grade,*LinkList;
struct grade *Copy( struct grade *prestorehead , struct grade *originalhead){
struct grade *neworiginalhead = originalhead;
struct grade *newprestorehead = prestorehead;
struct date *front = NULL , *newpoint;
LinkList head;
do{
//******************************************************************************
front = (linklist)malloc(sizeof(Date)); // [ 这是我刚刚加的,是这样分配吗? 老师您能凑合这些代码, 分配一下,标注出来吗?]
//*******************************************************************
newpoint = (linklist)malloc(sizeof(Date));
newpoint->prestoreboole = neworiginalhead->boole;
newpoint->neinext = NULL;
if( front == NULL ){
front = newpoint;
head->full = front;
}else{
front->neinext = newpoint->neinext;
front = front->neinext;
}
neworiginalhead = neworiginalhead->next;
}while(neworiginalhead != NULL);
head->full->cut = 1; // 这是第一个数,需要删除
return head;
}