请问一下结构体的有关问题!多谢
请教一下结构体的问题!谢谢
不知道什么地方错了,请指点一下,谢谢!!!
#include <iostream.h>
#include <malloc.h>
#include <conio.h>
#include <stdio.h>
typedef struct information
{
int num;
char name[10];
int garde;
}inf;
typedef struct student
{
inf m;
struct student *next;
}e;
e *creat(void) ;
e *del(e*);
e *insert(e*);
e *fr(e*);
e *node(e*)
void print(e*);
void save(e*);
void read();
void main()
{
e *head;
int d;
clrscr();
do
{
cout < < "input the number: ";
cin> > d;
switch(d)
{
case '1 ': head=creat();break;
case '2 ': print(head);break;
case '3 ': head=del(head); break;
case '4 ': head=insert(head); break;
case '5 ': head=fr(head); break;
case '6 ': save(head); break;
case '7 ': read(); break;
case '8 ': node(head); break;
default : ; break;
}
}while(d== '1 '||d== '2 '||d== '3 '||d== '4 '||d== '5 '||d== '6 '||d== '7 '||d== '8 ');
getch();
}
------解决方案--------------------
本来想给把程序改对的,却发现是C++,我只懂C,不过感觉你的命名难懂,还有while ( d> 0 && d <9 );与while(d== '1 '||d== '2 '||d== '3 '||d== '4 '||d== '5 '||d== '6 '||d== '7 '||d== '8 ');相同,但前者却简洁多了.....
------解决方案--------------------
汗!e *node(e*)
void print(e*);
前者结束缺少分号!
不知道什么地方错了,请指点一下,谢谢!!!
#include <iostream.h>
#include <malloc.h>
#include <conio.h>
#include <stdio.h>
typedef struct information
{
int num;
char name[10];
int garde;
}inf;
typedef struct student
{
inf m;
struct student *next;
}e;
e *creat(void) ;
e *del(e*);
e *insert(e*);
e *fr(e*);
e *node(e*)
void print(e*);
void save(e*);
void read();
void main()
{
e *head;
int d;
clrscr();
do
{
cout < < "input the number: ";
cin> > d;
switch(d)
{
case '1 ': head=creat();break;
case '2 ': print(head);break;
case '3 ': head=del(head); break;
case '4 ': head=insert(head); break;
case '5 ': head=fr(head); break;
case '6 ': save(head); break;
case '7 ': read(); break;
case '8 ': node(head); break;
default : ; break;
}
}while(d== '1 '||d== '2 '||d== '3 '||d== '4 '||d== '5 '||d== '6 '||d== '7 '||d== '8 ');
getch();
}
------解决方案--------------------
本来想给把程序改对的,却发现是C++,我只懂C,不过感觉你的命名难懂,还有while ( d> 0 && d <9 );与while(d== '1 '||d== '2 '||d== '3 '||d== '4 '||d== '5 '||d== '6 '||d== '7 '||d== '8 ');相同,但前者却简洁多了.....
------解决方案--------------------
汗!e *node(e*)
void print(e*);
前者结束缺少分号!