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>
#include<conio.h>
#include<string.h>
#define MAX 25
void inputDoctor(int);
void insertDoctor();
int searchDoctor(int);
void delDoctor();
void displayDoctor();
void inputPatient(int);
void insertPatient();
int searchPatient(int);
void delPatient();
void displayPatient();
void inputDocPatVisit(int);
void insertDocPatVisit();
int searchDocPatVisit(int);
void delDocPatVisit();
void displayDocPatVisit();
struct doctor
{
int docCode;
char name[20];
char address[100];
char splIn[30];
};
struct doctor doc[MAX];
struct patient
{
int patientCode;
char name[20];
char address[100];
char dis[30];
};
struct patient patient[MAX];
struct DocPatVisit
{
int docCode;
int patCode;
char DatOfVisit[10];
char Remark[100];
};
struct DocPatVisit DocPat[MAX];
int nDoc,recSizeDoc; /*Total number of elements in the list of Doctor and Recrd Siz */
int nPat,recSizePat; /*Total number of elements in the list of Patients and Recrd Siz */
int nDocPat,recSizeDocPat; /*Total number of elements in the list of Doctor Patients Visit and Recrd Siz */
FILE *fpDoc , *fpPat , *fpDocPat ;
void main()
{
int i=0,choice,pos,check,iptime=0;
int ldocCode,lpatientCode,lDocPatVisitCode;
int isRun1=1 ,isRun2=1;
fpDoc = fopen("DOC.dat","rb+");
if(fpDoc==NULL)
{
fpDoc = fopen("DOC.dat","wb+");
if(fpDoc == NULL)
{
puts("Can not open Source File");
getch();
exit(1);
}
}
recSizeDoc = sizeof(struct doctor);
////////////////////////////////////////////////////////////////////////
i=0;
rewind(fpDoc);
while(fread(&doc[i],recSizeDoc,1,fpDoc)==1)
{ i++; }
nDoc=i;
//////////////////////////////////
////////////////////////////////////////////////////////////////////////
fpPat = fopen("PAT.dat","rb+");
if(fpPat==NULL)
{
fpPat = fopen("PAT.dat","wb+");
if(fpPat == NULL)
{
puts("Can not open Source File");
getch();
exit(1);
}
}
recSizePat = sizeof(struct patient);
//////////////////////////////////
i=0;
rewind(fpPat);
while(fread(&patient[i],recSizePat,1,fpPat)==1)
{ i++; }
nPat=i;
//////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
fpDocPat = fopen("DOC_PAT.dat","rb+");
if(fpDocPat==NULL)
{
fpDocPat = fopen("DOC_PAT.dat","wb+");
if(fpDocPat == NULL)
{
puts("Can not open Source File");
getch();
exit(1);
}
}
recSizeDocPat = sizeof(struct DocPatVisit);
i=0;
rewind(fpDocPat);
while(fread(&DocPat[i],recSizeDocPat,1,fpDocPat)==1)
{ i++; }
nDocPat=i;
/////////////////////////////////////////////////////////////////////////////////////
while(isRun1)
{
printf("\n\n********************************************************************");
printf("\n Clinic Record Keeping System ");
printf("*******************************************************************************");
printf("\n\n1) Doctors List\n");
printf("\n2) Patients List\n");
printf("\n3) Doctor’s and Patient’s visits \n");
printf("\n4) Exit");
printf("\nEnter your choice : ");
scanf("%d",&choice);
isRun2=1;
///////////////////////////////////////////////////////////////////////////////////
switch(choice)
{
case 1:
while(isRun2)
{
printf("\n\n********************************************************************");
printf("\n DOCTORS LIST HANDLE ");
printf("*******************************************************************************");
printf("\n\n1.Input Record ( Over Write Old Records )\n");
printf("2.Insert Record\n");
printf("3.Search Record\n");
printf("4.Delete Record\n");
printf("5.Display Record\n");
printf("6.Save Record\n");
printf("7.Quit\n");
printf("\nEnter your choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\nHow Many Records You Want To STORE : ");
scanf("%d",&nDoc);
inputDoctor(nDoc);
break;
case 2:
insertDoctor();
break;
case 3:
printf("Enter the Doctor Code to be searched : ");
scanf("%d", &ldocCode);
pos = searchDoctor(ldocCode);
if(pos >= 1)
{
printf("\n\nDoctor Code \t: %d", doc[pos-1].docCode);
printf("\nName \t\t: %s", doc[pos-1].name);
printf("\nAddress \t: %s", doc[pos-1].address);
printf("\nSpecialized in \t: %s", doc[pos-1].splIn);
}
else
printf("Record not found ...\n");
break;
case 4:
delDoctor();
break;
case 5:
printf("\n\nDoctors Lists ...");
displayDoctor();
break;
case 6:
printf("\nSave is Started\n");
//fseek(fpDoc,0,SEEK_END);
rewind(fpDoc);
for(i = 0; i< nDoc ; i++)
{
fwrite(&doc[i],recSizeDoc,1,fpDoc);
}
printf("\nSave is Completed\n");
break;
case 7:
isRun2=0;
break;
default:
printf("Wrong choice\n");
} /*End of switch */
}/*End of while */
//////////////////////// end of doc
break ; // end of case 1 of outer switch
//////////////////////////////////////////// pat /////////////////////////
case 2:
while(isRun2)
{
printf("\n\n*************************************************************************");
printf("\n PATIENT LIST HANDLE ");
printf("*******************************************************************************");
printf("\n\n1.Input Record ( Over Write Old Records )\n");
printf("2.Insert Record\n");
printf("3.Search Record\n");
printf("4.Delete Record\n");
printf("5.Display
_______ ___ _________ __________ ____ ____ __________ _______ ______.
_______ _______ ___ ___ ______ _________.
___ ______ _______ _______ _____ ________ ________ ______ __________ ________ ____.
_______ ________ ________ ____ _____ _______ ______ ____ ____ ____.
____ _________ ___ ______ ____ _________ ________ _______ _______ _______ _________.
_____ ________ ___ ______ _____ _____ ________ ____.
_______ __________ _______ ___ _________ ________ ____.
________ _____ _____ _________ ____ _________ _____ _________ ________ _________ ____.
_______ ______ _______ ____ _____ _______ _____ _______ _____.
______ _________ _____ ______ ________.
_____ ________ _______ _______ ____ ________ ________ ______ ________ ________ ______ ___.
___ _______ ___ ______ ______ __________ __________.
___ ____ ____ _____ _______ ____ _______ _____ _________ __________ _______.
____ _______ _______ ______ ________ ___ ____ _________ ____ ______ ____.
_________ _______ ________ __________ _________ _________ _________ ________.
________ ______ ___ _______ _____.
____ _____ _____ ___ _________ _______ _____.
_______ ____ ________ __________ _________ ______ ________ _________.
_____ ___ _______ ____ ___.
________ _______ _______ _____ _______ __________ _____ _______ ____.
________ ____ _________ ___ _______ ____ _______ _______.
___ ___ _________ __________ ____.
__________ ________ ____ ___ _______ __________ ___ ________ ________.
____ ____ ______ ____ ______ _________ ___.
____ _____ _________ _______ __________ __________ _______ ____ _____.
____ _____ _____ ______ _______ _________ ________ _____ _____ __________.
__________ ___ _________ ___ ________ _____ _____ ____ __________ ______ ________ _______.
_________ ________ _________ ________ _____ _______.
________ ___ ____ ________ __________ ___ __________ _________.
_________ ____ ______ _________ __________ _______.
________ ____ ______ ___ __________ _______ ____.
_________ __________ ____ _______ ___.
________ _________ _________ ________ __________ ______.
_________ _______ ________ ______ _____ ________ ______ ______ ________.
_______ __________ ____ ___ ________ _________ _______ __________ _______ ________ __________.
_________ ________ ______ ____ ______ _______.
_______ ______ _____ _____ _________ __________ ___ ______.
_________ ____ _______ ________ ___ _____.
______ __________ ______ __________ _____.
__________ __________ _________ ________ _____ ______ _____ _______ ________.
___ ____ ___ ___ ___.
___ ____ _________ ___ ___ _____ _________ _____ ______.
________ ________ _____ ___ ________ __________ __________ ______ ______ _____ ___ ___.
________ _____ _________ ____ __________ _____ ________ ________.
______ ___ ______ _________ ________.
____ _______ ________ __________ ____ _______ ______.
___ ________ ______ ________ ____ _________ ________ _______ ____ __________.
____ ______ ____ ___ __________ _________ ______ ________ ______ ______ ______.
___ _______ _____ ______ ________ ___ ______ ____ _________ ______ _________ ______.
__________ __________ _________ _________ _________ ________ ______ __________ _________ ____ _____.
___ __________ ___ ______ _______ ______ ____ _________ __________ ___ _______.
_____ ___ _____ ___ ___ ________ __________.
_________ _______ _________ ________ _______ ________ ___ ___ ________ _______.
_______ ____ ________ ______ _________ ____ _____ __________.
____ ____ ______ _______ ________.
_____ ___ ______ _____ __________ __________ _______ _____.
__________ _______ ________ _____ __________ _______ ___ ____ ________ ____.
________ ___ ____ ___ __________ _________ ______ _____ ___ ________ __________ _______.
___ ___ __________ _____ ______ _________ _____ ________ __________ _________ ________.
_________ ____ ______ __________ ______ _____ __________ _______ __________ _______.
________ _________ ________ ___ ___ ____ _____ ______.
________ ___ ___ ____ ____ ________ ____.
____ ________ _______ ___ ____.
_______ ________ _____ _________ ________.
________ ___ ____ _________ _________ ___ ____ ____ ________.
________ _________ _________ _________ _________ _____ _______ __________ _________.
__________ ___ ___ ____ __________ ___ _______ ___.
_______ __________ ___ ______ _____.
____ ___ ____ ______ ______ _______ __________ __________ _______ ______ _____.
_________ ____ ____ ______ ______ ______ _______ ______ _____ ___ _____ ________.
______ _______ ____ __________ _____ _________ ________ ________ ___ _______ ___.
_________ _______ ____ _______ ____ _____ __________ _____ ________ ____.
_________ ___ _____ _________ ___ _______ ________ ________ ________ _________ __________ _____.
__________ ___ ___ ____ _____ _________ ________ ______ ______ _________ _________ _________.
______ _________ _____ _________ ___.
____ ______ _____ ____ _______ ______ ___ ______ ___.
__________ ________ __________ _______ ______ _________ ___ ______ _____ _______ ________.
_________ ________ _____ _______ _____.
________ _______ _____ __________ ________ _____ ______ ______ _______ __________ ______ __________.
______ ______ ________ _____ _____ ___ __________ _____ ________ _____.
____ _________ ________ _________ ____ _______ _______ ____ ______.
_________ _________ _______ _________ ____ _______ __________ ______ _________.
_____ ______ _____ ____ __________ ______ ______ ____ _______ _______.
________ ____ ___ ___ __________.
_________ __________ ____ ________ _____ ________ ________ __________.
___ ____ ____ _________ _____ ____ ___ ____ _______ _______.
_______ __________ ______ ___ ________ ______ ______ ___ ______ __________.
_____ ________ __________ ______ __________ __________.
____ _________ ___ _____ __________ ___ _____ _____ ___ __________.
_______ ______ _________ _______ ________ ___ __________ ____.
___ ___ ________ ______ _________ ____.
_____ _____ ______ _________ ______ _________ _____ ______ _________ ______ ______.
_____ _________ _________ ________ _________ _____.
__________ ______ __________ _______ ________ ____ _____ ___ __________.
___ ________ _____ _____ _______ _____ _____ __________ ________ _________.
_________ ___ __________ ________ ______ _____ _________ ______ ______ __________ _____.
__________ ______ _____ ______ _________ _______ ________ __________.
__________ ______ ____ ____ _____ _______ ____ _________ ______ ___.
___ _____ ______ _______ _____ ___ _________ ___.
_____ _________ _______ _________ _____ _______ __________.
_____ ____ ______ _________ ________ __________ _________ _____ _____.
__________ _________ _____ _____ ________ __________ _____ ___ ___.
_________ _________ ____ ________ ______ ________ _________ _____ _____ __________.
__________ _______ _______ __________ _______.
_______ ___ _______ ______ ____ ___ ______.
_________ _________ _________ _________ ____ _______ _________.
__________ ______ ______ ______ _________ __________ ________ __________ __________.
_______ ____ _____ ____ ________ __________ ________.
_______ _______ _________ _______ _______ ___.
__________ _____ _________ _____ _________ ____ ______ __________ _________ __________ _______.
________ _________ __________ _____ ___.
____ ___ ________ _______ ___ _______ ________ __________.
_____ ________ _____ ________ _______ _______ ________ _________ ______ ____.
__________ ______ ___ _____ __________ ______ __________ __________ ______.
___ __________ _________ __________ ____ _______.
____ _______ ___ _________ ________ ___ _______.
_________ _____ _______ ___ ______ _______ ___ __________ __________.
___ _______ ___ _______ _____ _________ ______ ___ ______.
_______ _____ _____ _________ _____ ___ ____.
____ ________ __________ __________ __________ _______ __________ ____ _________.
___ _________ _______ _________ ________ ________ __________ __________ ________ __________ ___ _______.
__________ _____ ______ ____ _____ ______ __________ _________ _________ ____ _________.
_______ ______ _________ _____ __________ ___ _____ __________ _____ _______.
_____ __________ _____ ______ _________ _____ __________.
_______ __________ _____ _____ ____ ____ _____ _______ ______ ______.
____ _____ _____ _______ _____ _____ _________ _____ ______ _____.
__________ _________ ______ ____ __________ _________ _____.
_________ ___ ___ _____ ______ __________ _______ __________ ___ _____.
________ _________ _________ __________ ____ _______ ___ ____.
_______ ________ __________ ________ ____ ____ _________ _____ _____ ________ ______.
____ _____ _______ __________ ______ ____ ________ ______.
____ __________ _____ ________ ______ ___ _____ _________.
___ ______ ___ ___ _____ ______ ____ __________ _________ ____ ______ ________.
___ ___ _________ __________ _____ __________ ______ __________.
_____ ______ _________ ______ ______ ________.
___ _____ _________ ___ __________ ______ _____ _________.
______ _____ _____ ________ _____ _____ ________.
_______ _________ ____ __________ _______ _______ _______ ___ ________ ______.
_______ __________ _________ ______ __________.
__________ _______ __________ ____ _________ __________ ___.
____ ________ ____ _______ ___ ________ ________ ______ _____ __________.
_______ ________ _____ _____ ______.
_____ ___ _________ _______ _________ _______.
__________ _________ _______ _________ _________ _________.
___ _______ _________ ________ ___ ____ ____ _____ _______ ___ ____.
________ _______ ________ ____ __________ __________ ___ ________.
___ _______ ____ ____ ___ _______ ____.
_______ ___ __________ _____ ___ _____ _________ ________ ______ ______ _______ ____.
____ __________ __________ ___ _______ ______.
__________ _____ __________ ____ _____ _____ _____ __________ ______.
________ _____ _________ _____ ______ _______ _________ __________ ____ ______ ___.
__________ _______ _____ ________ ____ ________ __________ _______ _____ _______.
_________ ________ __________ ________ _____ ___ ___.
______ ___ ______ _____ ___ ______.
______ ________ _______ ___ ________ _____ __________ _________ _______.
_______ ________ ________ ________ _________ ____ ____ ______.
___ ________ ____ ______ ___ _______ ____ _______ __________.
___ ____ ___ _____ ______ _______ ____ ____ ____ _________.
____ ____ _________ ____ _______ _______ ____ ____ _______ ________ __________ _______.
_________ ____ ____ ___ ____.
_____ _________ ____ ________ __________ ________ ______ ____ _____ __________ ____ __________.
______ ______ ______ ______ __________ ______ ________ _________ ___ ________ ________ _______.
___ ____ __________ __________ _______ _____ __________ ________ __________ ____ _________.
___ _______ __________ _________ __________ __________ ______ ________.
________ ___ _____ ____ _________ _________.
________ _________ __________ _______ __________ ____ _______ _________ _______.
_______ _____ ________ _____ __________ ____ ___ ____ _________ __________ _____.
______ ________ _________ ___ _______ _____.
___ __________ ______ ____ ___ _________ ___.
_____ __________ ____ ___ ________ _________ _____ __________ _____.
______ _______ __________ ________ ______ _____ __________ ______.
____ __________ _____ _____ _________ ________ ____.
__________ ______ ________ _____ _________ _________ _____ ________ __________ __________ _______ _______.
________ ______ ____ ___ __________ _____ ____ ______ _______ __________.
____ __________ _______ ______ ______ _________ __________ _____.
_________ _______ ___ ______ _________ __________.
_________ ____ __________ _____ __________ ______ __________.
________ _________ _________ ________ ______ _________ __________ _____.
___ _____ ____ _______ __________ _______ _____ ______ _______.
______ ___ ________ ____ ______.
________ _________ ______ ______ __________ ___ __________.
_______ ___ _______ ____ __________ ________ ________.
_______ ________ ________ ________ ________ ______ ___ ________ ______ __________ _________ _______.
_____ ______ ____ __________ _______ ______ __________ ___ ____ _______ ___ ___.
_____ ______ _____ _______ ___ ________ _____ ___ ___ __________ ___.
_______ _____ ________ _________ ___ __________ ______ __________ ________ _________ ______.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required