Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <string.h>
- #include <malloc.h>
- #include <Windows.h>
- // sinh vien thi co nhieu hon
- struct SinhVien{
- char Name[1000];
- char Code_of_student[10];
- char Lop[10];
- float Diem;
- struct SinhVien *next;
- };
- typedef struct SinhVien SV;
- SV *Head = NULL;
- SV *Tail = NULL;
- SV* produce_Set()
- {
- SV *Student = (SV *)malloc(sizeof(SV));
- return Student;
- }
- SV* set_note() // tao 1 note
- {
- SV *Student = produce_Set();
- fflush(stdin);
- printf("\nNhap Nhap Ten:"); gets(Student->Name);
- printf("\nNhap Ma So SV:"); gets(Student->Code_of_student);
- printf("\nNhap your class :"); gets(Student->Lop);
- printf("\nNhap Diem:"); scanf("%f", &Student->Diem); fflush(stdin);
- Student->next = NULL;
- return Student;
- }
- void Output()
- {
- int dem = 0;
- SV *p = Head;
- while (p != NULL)
- {
- printf("\n\nSinh Vien Thu %d !", dem + 1);
- printf("\n\nHo Va Ten: %s", p->Name);
- printf("\n\nMa So Sinh Vien: %s", p->Code_of_student);
- printf("\n\nLop: %s", p->Lop);
- printf("\n\nDiem: %f", p->Diem);
- printf("\n\n--------------------------------------");
- p = p->next;
- }
- getch();
- }
- int main()
- {
- SV *p;
- while (1)
- {
- system("cls");
- char temp;
- printf("Ban Co Muon Nhap Ko ? Neu 'Ko' Bam 'q', Neu 'Co' Thi Bam 1 Phim Bat Ky ");
- scanf("%c", &temp);
- if (temp == 'q' || temp == 'Q')
- {
- break;
- }
- if (Head == NULL)
- {
- Head = Tail = set_note();
- }
- else
- {
- p = set_note();
- Tail->next = p;
- Tail = p;
- }
- }
- do
- {
- system("cls");
- char choose_temp;
- printf("Chao Mung Ban Den Voi Danh Sach Sinh Vien Khoa Hoc Tu Nhien");
- printf("\n\nBam 1: De Xuat Danh Sach Sinh Vien.");
- printf("\n\nLua chon cua ban: "); scanf("%c", &choose_temp);
- switch (choose_temp)
- {
- case '1':
- {
- Output();
- break;
- }
- }
- } while (1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement