Advertisement
huutho_96

Untitled

Apr 2nd, 2015
392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <string.h>
  5. #include <malloc.h>
  6. #include <Windows.h>
  7. // sinh vien thi co nhieu hon
  8. struct SinhVien{
  9. char Name[1000];
  10. char Code_of_student[10];
  11. char Lop[10];
  12. float Diem;
  13. struct SinhVien *next;
  14. };
  15. typedef struct SinhVien SV;
  16. SV *Head = NULL;
  17. SV *Tail = NULL;
  18.  
  19. SV* produce_Set()
  20. {
  21. SV *Student = (SV *)malloc(sizeof(SV));
  22. return Student;
  23. }
  24. SV* set_note() // tao 1 note
  25. {
  26. SV *Student = produce_Set();
  27. fflush(stdin);
  28. printf("\nNhap Nhap Ten:"); gets(Student->Name);
  29. printf("\nNhap Ma So SV:"); gets(Student->Code_of_student);
  30. printf("\nNhap your class :"); gets(Student->Lop);
  31. printf("\nNhap Diem:"); scanf("%f", &Student->Diem); fflush(stdin);
  32. Student->next = NULL;
  33. return Student;
  34. }
  35. void Output()
  36. {
  37. int dem = 0;
  38. SV *p = Head;
  39. while (p != NULL)
  40. {
  41. printf("\n\nSinh Vien Thu %d !", dem + 1);
  42. printf("\n\nHo Va Ten: %s", p->Name);
  43. printf("\n\nMa So Sinh Vien: %s", p->Code_of_student);
  44. printf("\n\nLop: %s", p->Lop);
  45. printf("\n\nDiem: %f", p->Diem);
  46. printf("\n\n--------------------------------------");
  47. p = p->next;
  48. }
  49. getch();
  50. }
  51. int main()
  52. {
  53. SV *p;
  54. while (1)
  55. {
  56. system("cls");
  57. char temp;
  58. printf("Ban Co Muon Nhap Ko ? Neu 'Ko' Bam 'q', Neu 'Co' Thi Bam 1 Phim Bat Ky ");
  59. scanf("%c", &temp);
  60.  
  61. if (temp == 'q' || temp == 'Q')
  62. {
  63. break;
  64. }
  65. if (Head == NULL)
  66. {
  67. Head = Tail = set_note();
  68. }
  69. else
  70. {
  71. p = set_note();
  72. Tail->next = p;
  73. Tail = p;
  74. }
  75. }
  76. do
  77. {
  78. system("cls");
  79. char choose_temp;
  80. printf("Chao Mung Ban Den Voi Danh Sach Sinh Vien Khoa Hoc Tu Nhien");
  81. printf("\n\nBam 1: De Xuat Danh Sach Sinh Vien.");
  82. printf("\n\nLua chon cua ban: "); scanf("%c", &choose_temp);
  83. switch (choose_temp)
  84. {
  85. case '1':
  86. {
  87. Output();
  88. break;
  89. }
  90. }
  91. } while (1);
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement