Sei sulla pagina 1di 19

IGNOU MCA MCSL-17 Solved Assignment 2011

Course Code
Course Title
Assignment Number
Maximum Marks
:
Weightage
Last Dates for Submission

:
:
:
100
:
:

MCSL-017
C and Assembly Language Programming
MCA(1)/L017/Assign/2011
25%
30th April, 2011 (For January Session)
31st October, 2011 (For July Session)

This assignment has two sections. Answer all questions in each section. Each Sec
tion is of 20 marks. Your Lab Records will carry 40 Marks. Rest 20 marks are for
viva voce. You may use illustrations and diagrams to enhance the explanations.
Please go through the guidelines regarding assignments given in the programme
guide for the format of presentation.
Section 1: C Programmi
ng Lab
Question 1:
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, L
aboratory details, Bills, Payments etc. using the file handling concepts. The a
pplication should be designed user-friendly.
(20
Marks)
Note: You must execute the program and submit the program logic, sample input an
d output along with the necessary documentation for this question. Assumptions c
an be made wherever necessary.
Solution:
#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 Rec
rd Siz */
int nDocPat,recSizeDocPat; /*Total number of elements in the list of Doctor Pati
ents 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].doc
Code);
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 Reco
rds )\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 S
TORE : ");
scanf("%d",&nPat);
inputPatient(nPat);
break;
case 2:
insertPatient();
break;
case 3:
printf("Enter the Patient Code to be sea
rched : ");
scanf("%d", &lpatientCode);
pos = searchPatient(lpatientCode);
if(pos >= 1)
{
printf("\n\nPatient Code
: %d
", patient[pos-1].patientCode);
printf("\nPatient Name

: %s", patient[pos-1].

name);
printf("\nPatient Address : %s", patient[pos-1].
address);
printf("\nPatient disease : %s", patient
[pos-1].dis);
}
else
printf("Record not found ...\n")
;
break;
case 4:
delPatient();
break;
case 5:
printf("\n\nPatients Lists ...");
displayPatient();
break;

//

case 6:
//
printf("\nSave is Started\n");
fseek(fpPat,0,SEEK_START);

rewind(fpPat);
for(i = 0; i< nPat ; i++)
{
fwrite(&patient[i],recSizePat,1,fpPat);
}
printf("\nSave is Completed\n");
break;
case 7:
isRun2=0;
break;
default:
printf("Wrong choice\n");

} /*End of switch */
}/*End of while */
break;// end of Case 2 of Outer switch
/////////////////////////////////////////// end of pat//
case 3:
while(isRun2)
{
printf("\n\n****************************************************
****************");
printf("\n
DOCTORS PATIENTS VISIT LIST H
ANDLE
");
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",&nDocPat);
inputDocPatVisit(nDocPat);
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 : %d", doc[pos-1].docCod
e);
printf("\nDoctor Name : %s", doc[pos-1].name);
printf("\nDoctor Address : %s", doc[pos-1].addre
ss);
printf("\nDoctor Specialisd in : %s", doc[pos-1]
.splIn);
}
else
printf("Record not found ...\n");
break;
case 4:
delDoctor();
break;
*/
case 5:

printf("\n\nDoctors Patient Visits Lists ...");


displayDocPatVisit();
break;
case 6:
printf("\nSave is Started\n");
rewind(fpDocPat);
for(i = 0; i< nDocPat ; i++)
{
fwrite(&DocPat[i],recSizeDocPat,1,fpDocPat);
}
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 3 of outer switch
case 4:
isRun1=0;
fclose(fpDoc);
fclose(fpPat);
fclose(fpDocPat);
break;
}// end of outer switch
}// end of while
}// end of main()
/////////////////////////////////////////////////////////
void inputDoctor()
{
int i,j,flag=0,ldocCode;

for(i = 0; i< nDoc ; i++)


{
AGAIN:
flag=0;
printf("\n\nInput Doctors Code for Doctor %d : ", i+1);
scanf("%d", &ldocCode);
for(j=0;j<i;j++)
{
if(ldocCode==doc[j].docCode)
{
flag=1;
break;
}
}
if(flag==1)

{
printf("\n\n.Doctors Code Already Available !!");
goto AGAIN;
}
else
doc[i].docCode=ldocCode;
fflush(stdin);
printf("\nInput Name for Doctor %d : ", i+1);
gets(doc[i].name);
printf("\nInput Addrress for Doctor %d : ", i+1);
gets(doc[i].address);
printf("\nInput Specialized in for Doctor %d : ", i+1);
gets(doc[i].splIn);
fflush(stdin);
}
}/*End of inputDoctor()*/
int searchDoctor(int ldocCode)
{
int i;
for(i=0; i < nDoc; i++)
{
if(ldocCode == doc[i].docCode)
return(i+1);
}
return(0); /* If element not found */
}/*End of searchDoctor()*/
void insertDoctor()
{
char lname[20],laddress[100],lsplin[30];
int j,temp,ldocCode,position,flag;
if(nDoc == MAX)
{
printf("\nThere Is No Space !!\n");
return;
}
AGAIN:
printf("Enter position for insertion : (1 to %d )",nDoc+1);
scanf("%d", &position);
if(position > nDoc+1 )
{
printf("\nEnter position less than or equal to %d\n",nDoc+1);
goto AGAIN;
}
ASK_DOC_CODE:
flag=0;
printf("\n\nInput Doctor Code for Doctor %d : ", position);
scanf("%d", &ldocCode);
for(j=0;j<nDoc;j++)
{
if(ldocCode==doc[j].docCode)
{
flag=1;
break;

}
}
if(flag==1)
{
printf("\n\nDoctor Code Already Available !!");
goto ASK_DOC_CODE;
}
fflush(stdin);
printf("\nInput Name for Doctor %d : ", position);
gets(lname);
printf("\nInput Address for Doctor %d : ", position);
gets(laddress);
printf("\nInput Specialized in for Doctor %d : ", position);
gets(lsplin);
if( position == nDoc+1 ) /*Insertion at the end */
{
doc[nDoc].docCode = ldocCode;
strcpy(doc[nDoc].name,lname);
strcpy(doc[nDoc].address,laddress);
strcpy(doc[nDoc].splIn,lsplin);
nDoc = nDoc+1;
return;
}
/* Insertion in between */
temp=nDoc-1;
while( temp >= position-1)
{
doc[temp+1].docCode = doc[temp].docCode; /* shifting right */
strcpy(doc[temp+1].name,doc[temp].name);
strcpy(doc[temp+1].address,doc[temp].address);
strcpy(doc[temp+1].splIn,doc[temp].splIn);
temp --;
}
doc[position-1].docCode = ldocCode;
strcpy(doc[position-1].name,lname);
strcpy(doc[position-1].address,laddress);
strcpy(doc[position-1].splIn,lsplin);
nDoc = nDoc +1 ;
}/*End of insertDoctor()*/
void delDoctor()
{
int temp,position,ldocCode;
if(nDoc == 0)
{
printf("\nList underflow\n");
return;
}
printf("\nEnter the Doctor Code to be deleted : ");
scanf("%d",&ldocCode);
if(ldocCode == doc[nDoc-1].docCode) /*Deletion at the end*/
{
nDoc = nDoc-1;

return;
}
position=searchDoctor(ldocCode);
if(position==0)
{
printf("\nRecord Not Found ...\n");
return;
}
/*Deletion in between */
temp=position-1;
while(temp <= nDoc-1)
{
doc[temp].docCode = doc[temp+1].docCode; /* Shifting left */
strcpy(doc[temp].name,doc[temp+1].name);
strcpy(doc[temp].address,doc[temp+1].address);
strcpy(doc[temp].splIn,doc[temp+1].splIn);
temp ++;
}
nDoc = nDoc - 1 ;
}/*End of delDoctor()*/
void displayDoctor()
{
int i;
if(nDoc==0)
{
printf("\nDoctors is empty !!\n");
return;
}
for(i = 0; i< nDoc; i++)
{
printf("\n\nDoctor Code \t: %d", doc[i].docCode);
printf("\nName \t\t: %s", doc[i].name);
printf("\nAddress \t: %s", doc[i].address);
printf("\nSpecialized in \t: %s", doc[i].splIn);
}
}/*End of displayDoctor()*/
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////
void inputPatient()
{
int i,j,flag=0,lpatientCode;

for(i = 0; i< nPat ; i++)


{
AGAIN:
flag=0;
printf("\n\nInput Patients Code for Patient %d : ", i+1);
scanf("%d", &lpatientCode);
for(j=0;j<i;j++)
{
if(lpatientCode==patient[j].patientCode)
{

flag=1;
break;
}
}
if(flag==1)
{
printf("\n\nPatients Code Already Available !!");
goto AGAIN;
}
else
patient[i].patientCode=lpatientCode;
fflush(stdin);
printf("\nInput Name for Patient %d : ", i+1);
gets(patient[i].name);
printf("\nInput Addrress for Patient %d : ", i+1);
gets(patient[i].address);
printf("\nInput disease of Patient %d : ", i+1);
gets(patient[i].dis);
fflush(stdin);
}
}
//End of inputPatient()
int searchPatient(int lpatientCode)
{
int i;
for(i=0; i < nPat; i++)
{
if(lpatientCode == patient[i].patientCode)
return(i+1);
}
return(0); /* If element not found */
}/*End of searchPatient()*/
void insertPatient()
{
char lname[20],laddress[100],l_dis[30];
int j,temp,lpatientCode,position,flag;
if(nPat == MAX)
{
printf("\nThere Is No Space !!\n");
return;
}
AGAIN:
printf("Enter position for insertion : (1 to %d )",nPat+1);
scanf("%d", &position);
if(position > nPat+1 )
{
printf("\nEnter position less than or equal to %d\n",nPat+1);
goto AGAIN;
}
ASK_PAT_CODE:
flag=0;
printf("\n\nInput Patient Code for Patient %d : ", position);
scanf("%d", &lpatientCode);
for(j=0;j<nPat;j++)

{
if(lpatientCode==patient[j].patientCode)
{
flag=1;
break;
}
}
if(flag==1)
{
printf("\n\nPatient Code Already Available !!");
goto ASK_PAT_CODE;
}
fflush(stdin);
printf("\nInput Name for Patient %d : ", position);
gets(lname);
printf("\nInput Address for Patient %d : ", position);
gets(laddress);
printf("\nInput disease of Patient %d : ", position);
gets(l_dis);
if( position == nPat+1 ) /*Insertion at the end */
{
patient[nPat].patientCode = lpatientCode;
strcpy(patient[nPat].name,lname);
strcpy(patient[nPat].address,laddress);
strcpy(patient[nPat].dis,l_dis);
nPat = nPat+1;
return;
}
/* Insertion in between */
temp=nPat-1;
while( temp >= position-1)
{
patient[temp+1].patientCode = patient[temp].patientCode; /* shi
fting right */
strcpy(patient[temp+1].name,patient[temp].name);
strcpy(patient[temp+1].address,patient[temp].address);
strcpy(patient[temp+1].dis,patient[temp].dis);
temp --;
}
patient[position-1].patientCode = lpatientCode;
strcpy(patient[position-1].name,lname);
strcpy(patient[position-1].address,laddress);
strcpy(patient[position-1].dis,l_dis);
nPat = nPat +1 ;
}/*End of insertPatient()*/
void delPatient()
{
int temp,position,lpatientCode;
if(nPat == 0)
{
printf("\nList underflow\n");
return;

}
printf("\nEnter the Patient Code to be deleted : ");
scanf("%d",&lpatientCode);
if(lpatientCode == patient[nPat-1].patientCode) /*Deletion at the end*/
{
nPat = nPat-1;
return;
}
position=searchPatient(lpatientCode);
if(position==0)
{
printf("\nRecord Not Found ...\n");
return;
}
/*Deletion in between */
temp=position-1;
while(temp <= nPat-1)
{
patient[temp].patientCode = patient[temp+1].patientCode; /* Shi
fting left */
strcpy(patient[temp].name,patient[temp+1].name);
strcpy(patient[temp].address,patient[temp+1].address);
strcpy(patient[temp].dis,patient[temp+1].dis);
temp ++;
}
nPat = nPat - 1 ;
}/*End of delPatient()*/
void displayPatient()
{
int i;
if(nPat == 0)
{
printf("\nPatients List is empty !!\n");
return;
}
for(i = 0; i< nPat ; i++)
{
printf("\n\nPatient Code \t: %d", patient[i].patientCode);
printf("\nName \t\t: %s", patient[i].name);
printf("\nAddress \t: %s", patient[i].address);
printf("\ndisease \t: %s", patient[i].dis);
}
}/*End of displayPatient()*/
////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
///////////////////////////////
void inputDocPatVisit()
{
int i,j,flag=0,lpatientCode,lDocCode;
for(i = 0; i< nDocPat ; i++)
{
////////////////////
AGAIN_Doc:
flag=0;
printf("\nAvailable Doctors");

printf("\n------------------------------------------------------------");
displayDoctor();
printf("\n------------------------------------------------------------");
printf("\n\nInput Doctor Code for Doctor Patient Visit %d : ",
i+1);
scanf("%d", &lDocCode);
for(j=0;j<nDoc ;j++)
{
if(lDocCode==doc[j].docCode)
{
flag=1;
break;
}
}
if(flag==0)
{
printf("\n\nDoctor Code is Not Available !!");
goto AGAIN_Doc;
}
else
DocPat[i].docCode =lDocCode;
/////////////////////////////////////
AGAIN_Pat:
flag=0;
printf("\nAvailable Patients");
printf("\n------------------------------------------------------------");
displayPatient();
printf("\n------------------------------------------------------------");
printf("\n\nInput Patient Code for Doctor Patient Visit %d : ",
i+1);
scanf("%d", &lpatientCode);
for(j=0;j<nPat;j++)
{
if(lpatientCode==patient[j].patientCode)
{
flag=1;
break;
}
}
if(flag==0)
{
printf("\n\nPatient Code is Not Available !!");
goto AGAIN_Pat;
}
else
DocPat[i].patCode =lpatientCode;
fflush(stdin);
printf("\nInput Date for Doctor Patient Visit %d : ", i+1);
gets(DocPat[i].DatOfVisit);
printf("\nInput Remarks for Doctor Patient Visit %d : ", i+1);
gets(DocPat[i].Remark);
fflush(stdin);

}
}/*End of inputDocPatVisit()*/
/*
int searchDocPatVisit(int lpatientCode)
{
int i;
for(i=0; i < nPat; i++)
{
if(lpatientCode == patient[i].patientCode)
return(i+1);
}
return(0); // If element not found
}
// End of searchDocPatVisit()
void insertDocPatVisit()
{
char lname[20],laddress[100],l_dis[30];
int j,temp,lpatientCode,position,flag;
if(nPat == MAX)
{
printf("\nThere Is No Space !!\n");
return;
}
AGAIN:
printf("Enter position for insertion : (1 to %d )",nPat+1);
scanf("%d", &position);
if(position > nPat+1 )
{
printf("\nEnter position less than or equal to %d\n",nPat+1);
goto AGAIN;
}
ASK_PAT_CODE:
flag=0;
printf("\n\nInput DocPatVisit Code for DocPatVisit %d : ", posi
tion);
scanf("%d", &lpatientCode);
for(j=0;j<nPat;j++)
{
if(lpatientCode==patient[j].patientCode)
{
flag=1;
break;
}
}
if(flag==1)
{
printf("\n\nDocPatVisit Code Already Available !!");
goto ASK_PAT_CODE;
}
fflush(stdin);
printf("\nInput Name for DocPatVisit %d : ", position);
gets(lname);
printf("\nInput Address for DocPatVisit %d : ", position);
gets(laddress);
printf("\nInput disease of DocPatVisit %d : ", position);
gets(l_dis);

if( position == nPat+1 ) //Insertion at the end


{
patient[nPat].patientCode = lpatientCode;
strcpy(patient[nPat].name,lname);
strcpy(patient[nPat].address,laddress);
strcpy(patient[nPat].dis,l_dis);
nPat = nPat+1;
return;
}
// Insertion in between
temp=nPat-1;
while( temp >= position-1)
{
patient[temp+1].patientCode = patient[temp].patientCode; //shif
ting right
strcpy(patient[temp+1].name,patient[temp].name);
strcpy(patient[temp+1].address,patient[temp].address);
strcpy(patient[temp+1].dis,patient[temp].dis);
temp --;
}
patient[position-1].patientCode = lpatientCode;
strcpy(patient[position-1].name,lname);
strcpy(patient[position-1].address,laddress);
strcpy(patient[position-1].dis,l_dis);
nPat = nPat +1 ;
}
// End of insertDocPatVisit()
void delDocPatVisit()
{
int temp,position,lDocPatCode;
if(nDocPat == 0)
{
printf("\nList underflow\n");
return;
}
printf("\nEnter the DocPatVisit Code to be deleted : ");
scanf("%d",&lpatientCode);
if(lpatientCode == patient[nPat-1].patientCode) // Deletion at the end
{
nPat = nPat-1;
return;
}
position=searchDocPatVisit(lpatientCode);
if(position==0)
{
printf("\nRecord Not Found ...\n");
return;
}
// Deletion in between
temp=position-1;
while(temp <= nPat-1)
{
patient[temp].patientCode = patient[temp+1].patientCode; // Shi

fting left
strcpy(patient[temp].name,patient[temp+1].name);
strcpy(patient[temp].address,patient[temp+1].address);
strcpy(patient[temp].dis,patient[temp+1].dis);
temp ++;
}
nPat = nPat - 1 ;
}
*/
//End of delDocPatVisit()
void displayDocPatVisit()
{
int i;
int ldocIndex ,lPatIndex;
if(nDocPat == 0)
{
printf("\nDoctor Patient Visits List is empty !!\n");
return;
}
for(i = 0; i< nDocPat ; i++)
{
ldocIndex=searchDoctor(DocPat[i].docCode);
ldocIndex--;
printf("\n---------------------------------------------------------");
printf("\nDoctor Name
: %s ",doc[ldocIndex].n
ame);
printf("\nDoctore Specialisd in : %s ",doc[ldocIndex].splIn);
printf("\n----------------------------------------------------------");
lPatIndex=searchPatient(DocPat[i].patCode );
lPatIndex--;
printf("\nPatient Name
: %s ", patient[i].name);
printf("\nPatient disease : %s ", patient[i].dis);
printf("\n----------------------------------------------------------");
printf("\nDate of Visit : %s ", DocPat[i].DatOfVisit);
printf("\nRemarks
: %s ", DocPat[i].Remark);
printf("\n----------------------------------------------------------");
}
}/*End of displayDocPatVisit()*/
=======================================================================
Section 2: Assembly Language Programming Lab
Question 1:
(a)
Write a program in assembly language to sort an array of signed integers
and search for the presence of an item in the sorted array using linear search
(5 Marks)
(b)

Develop and execute an assembly language program to find the HCF of two

unsigned 16-bit numbers.


(5 Marks)
(c )
Write a program in assembly language for finding the largest number in a
n array of 10 elements.
(5 Marks)
(d)
Given a string of characters terminated by 00H, write a assembly languag
e program to determine if it is a palindrome. If 'Yes' output the message " The
given string is a palindrome. If 'No' output the message "No, it is not a palind
rome"
(5 Marks)
Solution: Coming soon..
================================================================================
================================================================================
==========================THE END===================================

Potrebbero piacerti anche