{
DataType data [ListSize];
DataType length;
} SeqList above change will be the next line elsewhere at this mistake;
Void main () {
The error C2144: syntax error: missing '; 'before the type' void '
Fatal error C1004: unexpected end of file found
Behind the SeqList plus a semicolon error is more behind the SWITCH calls the function also has a problem,,, just learn good south, data structure,
The following is the complete code
# define ListSize 20
# include
# include
Typedef int DataType.
Void InitList ();
Void lastinto ();
Void findone ();
Int sureinto ();
Void watchall ();
Void ClearList ();
Void the alter ();
Int delsure ();//10
Typedef struct
{
DataType data [ListSize];
DataType length;
} SeqList
Void main () {
Int I, s=1, e, z;
While (s) {
Printf (" please enter to operate: \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
Printf (" | | 1: create a new table \ n ");
Printf (" | 2: tail interpolation insert data \ n | ");
Printf (" \ n | | 3: place named insert data ");
Printf (" | | 4: delete specified locations \ n ");//20
Printf (" \ | 5: modify the designated place position n | ");
Printf (" \ n | | 6: search data ");
Printf (" | | 7: check the order table \ n ");
Printf (" | 8: empty sequence table \ n | ");
Printf (" | | 9: exit \ n ");
Printf (" -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- \ n ");
The scanf (" % d ", & amp; I);
If (i<0 | | i> 8) {
Printf (" error ");
}//30
The switch (I) {
Case 1: InitList (L); break;
Case 2: the scanf (" % d ", & amp; E); Lastinto (L, e); break;
Case 3: the scanf (" % d ", & amp; E); The scanf (" % d ", & amp; Z); Sureinto (L, e, z); break;
Case 4: the scanf (" % d ", & amp; E); The scanf (" % d ", & amp; Z); Delsure (L, e, z); break;
Case 5: the scanf (" % d ", & amp; E); The scanf (" % d ", & amp; Z); The alter (L, e, z); break;
Case 6: the scanf (" % d ", & amp; E); Findone (L, e); break;
Case 7: watchall (L); break;
Case 8: ClearList (L); break;
Case 9: s=0; break;//40
}
}
}
Void InitList (SeqList L) {
If (L - & gt; Length==0) {
return;
}
L - & gt; Length=0;
}
Void lastinto (SeqList L, DataType e) {
If (L - & gt; Length==ListSize)//60
{
Printf (" order form is full, can't insert! \n");
}
L - & gt; Data [L - & gt; length]=e;
L - & gt; length++;
}
Int sureinto (SeqList L, DataType e, int z) {
If (z<1 | | z> L - & gt; Length)
{//70
Printf (" insert position illegal! \n");
return 0;
}
If (L - & gt; Length==ListSize)
{
Printf (" order form is full, can't insert! \n");
}
Int x=L - & gt; Length, k;
For (k=z; k<=L - & gt; Length; K++)
{//80
L - & gt; Data [x]=L - & gt; Data [x - 1);
X -;
}
L - & gt; Data [z - 1]=e;
L - & gt; length++;
return 1;
}
Int delsure (SeqList L, DataType * e, int z) {
Int k, x;
If (z> L - & gt; Length | | L - & gt; Length<1) {//90
Printf (" error ");
return 0;
}
* e=L - & gt; Data [z - 1);
For (k=z; k<=L - & gt; Length; K++)
{
L - & gt; Data [1] x=L - & gt; Data [x];
X++;
}
L - & gt; Length -;//100
Return * e;
}
Void the alter (SeqList L, DataType e, int z) {
If (z<1 | | z> L - & gt; Length + 1) {
Printf (" error ");
}
The else {
L - & gt; Data [z - 1]=e;
}
}//110
Void ClearList (SeqList L)
{
L - & gt; length=0;
}
Void watchall SeqList (L) {int k;
For (k=0; K & lt; L - & gt; Length; K++)
{
Printf (" % d, L - & gt; Data [k]);
}
printf("\n");//120
}
Void findone (SeqList L, DataType e) {
Int k; Int l=0;
for(k=0; k
If (L - & gt; Data [k]==e) {
Printf (" the subscript for % d ", l);
}
}
}
CodePudding user response:
} SeqList;CodePudding user response: