Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- struct doct
- {
- char n[100];
- char s[100];
- int a;
- char add[100];
- int ph;
- int r;
- char avd[100];
- char del[10];//delete
- } d[20];
- int pos[100],k;
- void display1(int a1,int a2)
- {
- FILE *file;
- file = fopen("dipu.txt","w+");
- system("cls");
- for (a1=0; a1<a2; a1++)
- {
- if(pos[a1]==1) continue;
- 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);
- 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);
- }
- }
- void display2(int b1,int b2)
- {
- FILE *file;
- file = fopen("dipu.txt","w+");
- int L;
- system("cls");
- printf("search any doctor's personal information:\n");
- printf("\t\t\t\t\tenter reg no:");
- scanf("%d",&L);
- for(b1=0; b1<b2; b1++)
- {
- if(L==d[b1].r)
- {
- 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);
- 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);
- }
- }
- }
- void display3(int c1,int c2)
- {
- FILE *file;
- file = fopen("dipu.txt","w+");
- int T;
- system("cls");
- printf("please enter reg no to search doctors available date:");
- scanf("%d",&T);
- for(c1=0; c1<c2; c1++)
- {
- if(T==d[c1].r)
- {
- printf("The available date is=%s\n",d[c1].avd);
- }
- }
- }
- void display4(int d1,int d2)
- {
- int position;
- printf("please enter the doctor's location that u want to be deleted: ");
- scanf("%d",&position);
- int cnt=0,j;
- for(j=0;j<k;j++)
- {
- if(pos[j]==0) cnt++;
- if(cnt==position) {
- pos[j]=1;
- //printf("please\n");
- break;
- }
- }
- }
- main()
- {
- FILE *file;
- file = fopen("dipu.txt","w+");
- int v,p,i,c,y;
- printf("\t\t\t\t\tKHULNA MEDICAL COLLEGE HOSPITAL\n");
- printf("\t\t\t\t\t Welcome to our site\n");
- fprintf(file,"\t\t\t\t\tKHULNA MEDICAL COLLEGE HOSPITAL\n");
- fprintf(file,"\t\t\t\t\t Welcome to our site\n");
- next:
- printf("\n\t\tEnter password to access the system....(4 digit must..) = ");
- scanf("%d",&p);
- if(p==2587)//passward 2587
- {
- goto loop;
- system("cls");
- }
- else
- {
- printf("incorrect password...try again....:");
- goto next;
- }
- loop:
- system("cls");
- while (1)
- {
- printf("\n\n\t\tplease enter '1' to get doctors data:\n");
- printf("\t\tplease enter '2' to show doctors data:\n");
- printf("\t\tplease enter '3' to search any doctors data:\n");
- printf("\t\tplease enter '4' to search any doctors available date:\n");
- printf("\t\tplease enter '5' to delete any doctor's data:\n");
- printf("\t\tplease enter '6' to exit program:\n");
- printf("\t\tEnter your choice :");
- scanf("%d",&c);
- switch(c)
- {
- case 1:
- system("cls");
- printf("\n\n\t\tEnter doctor name :");
- scanf("%s",d[k].n);
- printf("\t\tEnter doctor address :");
- scanf("%s",d[k].add);
- printf("\t\tEnter doctor age :");
- scanf("%d",&d[k].a);
- printf("\t\tEnter section :");
- scanf("%s",d[k].s);
- printf("\t\tEnter phone number :");
- scanf("%d",&d[k].ph);
- printf("\t\tEnter registration number :");
- scanf("%d",&d[k].r);
- printf("\t\tEnter available date :");
- scanf("%s",d[k].avd);
- k++;
- break;
- case 2:
- display1(i,k);
- break;
- case 3:
- display2(i,k);
- break;
- case 4:
- display3(i,k);
- break;
- case 5:
- display4(i,k);
- break;
- case 6:
- {
- exit(0);
- }
- }
- }
- fclose(file);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement