Mọi người thông cảm do em tìm mãi lỗi ở chỗ xuất ra không được nên lên đây mạn phép post len
#include <conio.h>
#include <stdio.h>
#include <malloc.h>
// tạo đối tượng Sinh Viên ( 1 NOTE )
struct SinhVien {
char FullName[1000];
char Old[3];
char SEX[5];
float Toan,Ly,Hoa;
};
typedef struct SinhVien SV;
// tao Danh sách để quản lý .
struct NhaTruong {
SV Person;
NhaTruong *next; // con trỏ next .
};
typedef struct NhaTruong Home;
void Produce(Home *&Node){
Node = (Home *)malloc(sizeof(Home));
}
void main() {
int chon;
Home *dssv; // khai báo 1 danh sach sinh vien
Produce(dssv);
Home *HEAD = NULL;
Home *Tail = NULL;
HEAD = dssv;
while(1)
{
printf("Enter your FullName: "); gets(dssv->Person.FullName);
printf("Enter your Old: "); gets(dssv->Person.Old);
printf("Enter your SEX: "); gets(dssv->Person.SEX);
fflush(stdin);
printf("Enter your point: "); scanf("%d", &dssv->Person.Toan);
printf("Enter your point: "); scanf("%d", &dssv->Person.Ly);
printf("Enter your point: "); scanf("%d", &dssv->Person.Hoa);
Produce(dssv->next); // cấp phát cho con NODE tiếp theo
dssv = dssv->next; // cho NODE 1 >> nối NODE 2.
printf("You want Enter Information!");scanf("%d", &chon);
fflush(stdin);
if(chon == 0)
{
dssv = NULL;
break;
}
}
dssv = HEAD;
while( dssv != NULL)
{
printf("\nHo Va Ten: %s", dssv->Person.FullName);
dssv = dssv->next;
}
getch();
}
Mong mọi người giúp em @@