The original subject requirement is: 1. The use of teaching materials are defined in the order sheet type storage patient record information (case number, name, symptom); Requires the use of header files,
Table 2. The design sequence locating algorithm, write a function to complete the functions as follows: to look for in the linear table L data element x, if there is a linear table and returns the x value equal to the first serial number of data elements; If not, it returns 1,
Function is defined as an int ListFind (SequenceList L, char * x)
Please test to find whether there is a name in the main function for the patients with x, according to the serial number of the return to print out the patient information,
The design sequence table locating algorithm change there is really bad, also want to big trouble please help see,
#include
#include
# define MaxSize 100
Typedef struct {
Int num [100].//card number;
Char name [10].//the name;
Char Symptom [10].//diagnosis;
int length;
} patient;
Void Insert (patient & amp; L);
Int ListFind (patient L, char * x);
Int main (void) {
Patient L;
L.length=0;
int i;
Char name [10].
Insert (L);
If (ListFind (L, name) & lt; 0 {
Printf (" no such person ");
}
The else {
I=ListFind (L, name);
Printf (" \ n case number: % d ", L.n um [I]);
Printf (" name: % s \ n ", L.n ame [I]);
Symptoms: printf (" % s \ n ", L.S ymptom [I]);
}
Return 0;
}
Void Insert (patient 1)
{
Int n;
Printf (" please input the number of patients to register: \ n ");
The scanf (" % d ", & amp; N);
for(int i=0; i
Printf (" case number: ");
The scanf (" % d ", & amp; L.n um [I]);
Printf (" name: ");
The scanf (" % s ", & amp; L.n ame [I]);
Printf (" symptoms: ");
The scanf (" % s ", & amp; L.S ymptom [I]);
printf("\n");
}
}
Int ListFind (patient L, char * x)
{
Int I, flog=0;
for(i=0; i
Flog=1;
break;
}
}
If (flog==1)
return i;
The else
return -1;
}
If you can, also want to big help, please write a code in the header file,
The following is a header file "Sequencelist. H"
#include
# define MaxSize 100
Typedef struct {
ElemType list [MaxSize];
int size;
} SequenceList;
Void ListInitialize (SequenceList * L)
{
L - & gt; Size=0;
}
Int ListLength SequenceList (L)
{
Return L.s considering;
}
Int ListInsert (SequenceList * L, int I ElemType x)
{
Int j;
If (L - & gt; Size>=MaxSize)
{
Printf (" order table was unable to look up into the full! \n");
return 0;
}
Else if (i<0 | | i> L - & gt; The size)
{
Printf (" parameter I illegal! \n");
return 0;
}
The else {
For (j=L - & gt; The size; J> i; J -)
L - & gt; The list [j]=L - & gt; List] [j - 1;
L - & gt; The list [I]=x;
L - & gt; Size++;
return 1;
}
}
Int ListDelete (SequenceList * L, int I ElemType * x)
{
Int j;
If (L - & gt; Size<=0) {
Printf (" countless according to sequence table has been empty elements can be deleted! \n");
return 0;
}
Else if (i<0 | | i> L - & gt; The size 1) {
Printf (" parameter I illegal ");
return 0;
}
The else {
* x=L - & gt; The list [I];
For (j=I + 1; j<=L - & gt; Size - 1; J++)
L - & gt; List] [j - 1=L - & gt; The list [j];
L - & gt; Size -;
return 1;
}
}
Int ListGet (int I SequenceList L, ElemType * x)
{
If (i<0 | | i> L.s considering 1) {
Printf (" parameter I illegal ");
return 0;
}
The else {
* x=L.l ist [I];
return 1;
}
}