Advertisement
Guest User

Untitled

a guest
Jan 8th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. struct doct
  4. {
  5. char n[100];
  6.  
  7. char s[100];
  8. int a;
  9. char add[100];
  10. int ph;
  11. int r;
  12. char avd[100];
  13. char del[10];//delete
  14.  
  15. } d[20];
  16.  
  17. int pos[100],k;
  18.  
  19.  
  20. void display1(int a1,int a2)
  21. {
  22. FILE *file;
  23. file = fopen("dipu.txt","w+");
  24. system("cls");
  25. for (a1=0; a1<a2; a1++)
  26. {
  27. if(pos[a1]==1) continue;
  28. printf("\nName:%s Address:%s Age:%d Section:%s Phone_no:%d Reg:%d\n ",d[a1].n,d[a1].add,d[a1].a,d[a1].s,d[a1].ph,d[a1].r);
  29. fprintf(file,"\nName:%s Address:%s Age:%d Section:%s Phone_no:%d Reg:%d\n ",d[a1].n,d[a1].add,d[a1].a,d[a1].s,d[a1].ph,d[a1].r);
  30.  
  31. }
  32.  
  33.  
  34.  
  35. }
  36.  
  37. void display2(int b1,int b2)
  38. {
  39. FILE *file;
  40. file = fopen("dipu.txt","w+");
  41. int L;
  42. system("cls");
  43. printf("search any doctor's personal information:\n");
  44. printf("\t\t\t\t\tenter reg no:");
  45.  
  46. scanf("%d",&L);
  47. for(b1=0; b1<b2; b1++)
  48. {
  49. if(L==d[b1].r)
  50. {
  51. printf("\nName:%s Address:%s Age:%d Section:%s Phone_no:%d Reg:%d\n ",d[b1].n,d[b1].add,d[b1].a,d[b1].s,d[b1].ph,d[b1].r);
  52. fprintf(file,"\nName:%s Address:%s Age:%d Section:%s Phone_no:%d Reg:%d\n ",d[b1].n,d[b1].add,d[b1].a,d[b1].s,d[b1].ph,d[b1].r);
  53.  
  54. }
  55.  
  56. }
  57.  
  58. }
  59. void display3(int c1,int c2)
  60. {
  61. FILE *file;
  62. file = fopen("dipu.txt","w+");
  63. int T;
  64. system("cls");
  65. printf("please enter reg no to search doctors available date:");
  66. scanf("%d",&T);
  67. for(c1=0; c1<c2; c1++)
  68. {
  69. if(T==d[c1].r)
  70. {
  71.  
  72. printf("The available date is=%s\n",d[c1].avd);
  73.  
  74. }
  75. }
  76.  
  77. }
  78.  
  79. void display4(int d1,int d2)
  80.  
  81. {
  82. int position;
  83. printf("please enter the doctor's location that u want to be deleted: ");
  84. scanf("%d",&position);
  85. int cnt=0,j;
  86. for(j=0;j<k;j++)
  87. {
  88. if(pos[j]==0) cnt++;
  89. if(cnt==position) {
  90. pos[j]=1;
  91. //printf("please\n");
  92. break;
  93. }
  94. }
  95.  
  96. }
  97.  
  98. main()
  99. {
  100. FILE *file;
  101. file = fopen("dipu.txt","w+");
  102. int v,p,i,c,y;
  103.  
  104.  
  105.  
  106.  
  107. printf("\t\t\t\t\tKHULNA MEDICAL COLLEGE HOSPITAL\n");
  108. printf("\t\t\t\t\t Welcome to our site\n");
  109. fprintf(file,"\t\t\t\t\tKHULNA MEDICAL COLLEGE HOSPITAL\n");
  110. fprintf(file,"\t\t\t\t\t Welcome to our site\n");
  111.  
  112. next:
  113.  
  114. printf("\n\t\tEnter password to access the system....(4 digit must..) = ");
  115. scanf("%d",&p);
  116.  
  117.  
  118.  
  119. if(p==2587)//passward 2587
  120. {
  121. goto loop;
  122. system("cls");
  123. }
  124.  
  125.  
  126. else
  127. {
  128. printf("incorrect password...try again....:");
  129. goto next;
  130.  
  131. }
  132.  
  133.  
  134. loop:
  135.  
  136.  
  137. system("cls");
  138. while (1)
  139. {
  140. printf("\n\n\t\tplease enter '1' to get doctors data:\n");
  141. printf("\t\tplease enter '2' to show doctors data:\n");
  142. printf("\t\tplease enter '3' to search any doctors data:\n");
  143. printf("\t\tplease enter '4' to search any doctors available date:\n");
  144. printf("\t\tplease enter '5' to delete any doctor's data:\n");
  145. printf("\t\tplease enter '6' to exit program:\n");
  146. printf("\t\tEnter your choice :");
  147. scanf("%d",&c);
  148.  
  149. switch(c)
  150. {
  151.  
  152. case 1:
  153. system("cls");
  154.  
  155. printf("\n\n\t\tEnter doctor name :");
  156. scanf("%s",d[k].n);
  157. printf("\t\tEnter doctor address :");
  158. scanf("%s",d[k].add);
  159. printf("\t\tEnter doctor age :");
  160. scanf("%d",&d[k].a);
  161. printf("\t\tEnter section :");
  162. scanf("%s",d[k].s);
  163. printf("\t\tEnter phone number :");
  164. scanf("%d",&d[k].ph);
  165. printf("\t\tEnter registration number :");
  166. scanf("%d",&d[k].r);
  167. printf("\t\tEnter available date :");
  168. scanf("%s",d[k].avd);
  169.  
  170.  
  171. k++;
  172.  
  173. break;
  174.  
  175. case 2:
  176.  
  177. display1(i,k);
  178. break;
  179.  
  180. case 3:
  181. display2(i,k);
  182.  
  183. break;
  184.  
  185. case 4:
  186.  
  187. display3(i,k);
  188.  
  189.  
  190.  
  191. break;
  192. case 5:
  193.  
  194. display4(i,k);
  195.  
  196. break;
  197.  
  198. case 6:
  199. {
  200. exit(0);
  201. }
  202.  
  203.  
  204. }
  205. }
  206.  
  207. fclose(file);
  208. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement