Doctor Patient File Handling coderinme

Doctor Patient File Handling coderinme

Doctor Patient File Handling coderinme
Let us now write an interactive program in C language to manage the Clinic Information with menu options like Patient’s details, Doctor’s details, Doctor’s and Patient’s visits, Laboratory details, Bills, Payments etc. using the file handling concepts. The application should be designed user-friendly

#include<stdio.h>
int main()
{
FILE *inp;
int ch = 1;
char c = 0;
while(ch != 7)
{
printf("\nGive your choice please:\n1:patients details\n2:Doctors details\n3:Doctors visit\n4:Patients visit\n5:Laboratory Details\n6:Bills and Payments\n7:TO exit\n");
scanf("%d",&ch);
if(ch==1)
{
inp=fopen("patient.txt","r");
fscanf(inp,"%c",&c);
while(!feof(inp))
{
printf("%c",c);
fscanf(inp,"%c",&c);
}
printf("\n");
fclose(inp);
}
else if(ch==2)
{
inp=fopen("doctor.txt","r");
fscanf(inp,"%c",&c);
while(!feof(inp))
{
printf("%c",c);
fscanf(inp,"%c",&c);
}
printf("\n");
fclose(inp);
}
else if(ch==3)
{
inp=fopen("doctor_visit.txt","r");
fscanf(inp,"%c",&c);
while(!feof(inp))
{
printf("%c",c);
fscanf(inp,"%c",&c);
}
printf("\n");
fclose(inp);
}
else if(ch==4)
{
inp=fopen("patient_visit.txt","r");
fscanf(inp,"%c",&c);
while(!feof(inp))
{
printf("%c",c);
fscanf(inp,"%c",&c);
}
printf("\n");
fclose(inp);
}
else if(ch==5)
{
inp=fopen("laboratory.txt","r");
fscanf(inp,"%c",&c);
while(!feof(inp))
{
printf("%c",c);
fscanf(inp,"%c",&c);
}
printf("\n");
fclose(inp);
}
else if(ch==6)
{
inp=fopen("bill.txt","r");
fscanf(inp,"%c",&c);
while(!feof(inp))
{
printf("%c",c);
fscanf(inp,"%c",&c);
}
printf("\n");
fclose(inp);
}
else if(ch==7);
else
printf("Please give the correct choice.\n");
}
getch();
return 0;
}

For more programs in C, visit our C Coder Archives

Doctor Patient File Handling coderinme
Doctor Patient File Handling coderinme

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.