# include
# include
# define Max 100
Typedef struct students
{
Int number (Max);
Int score;
} the list;
Typedef list datatype;
Typedef struct shunxubiao
{
Datatype students (Max);
Int length;
} the info;
The info kong ();//empty a sequence table
Void the Scanf info (L);//to the order of input to input data in the table
Void printflist info (L);//this function is a function for the output of the
Int main ()
{
The info A=kong ();//define a sequence table!
The Scanf (A);//to the order of input to input data in the table
Printflist (A);
return 0;
}
Info kong ()//empty a sequence table
{
The info L;
L.l ength=0;
Return the L;
}
Void the Scanf info (L)//input to input the data in the table to order
{
If (L.l ength==Max)
{
Printf (" sequence in the table is full, can't be input ");
exit(1);
}
char ch;
Do
{
Printf (" please enter the student achievement: ");
The scanf (" % d ", & amp; L.s tudents [L.l ength++]. Score);
Printf (" please enter the student's student id: ");
The scanf (" % d ", & amp; L.s tudents [L.l ength++]. Number);
Printf (" whether to continue the input? (Y | | N) : ");
The scanf (" % c ", & amp; Ch);
L.l ength++;
} while (ch=='y' | | ch=='y');
}//this function is for data input and prepare
Void printflist info (L)//this function is a function for the output of the
{
int i;
for (i=0; i
Printf (" student achievement ");
Printf (" % d ", L.s tudents [I] score).
Printf (" the student's student id ");
Printf (" % s ", L.s tudents [I] number);
}
}
There is no way to order table traversal output request help, how should be modified
CodePudding user response:
The use of vs2019CodePudding user response:
Child function are the value, the main function of the order of the table in A data?CodePudding user response:
Same vs2019 when you compile this error
CodePudding user response:
Modify, for reference can run normally,
# define _CRT_SECURE_NO_WARNINGS
#include
# include
# include
# define M 100
Typedef struct students
{
Int number;
Int score;
} the list;
Typedef list datatype;
Typedef struct shunxubiao
{
Datatype students [M];
Int length;
} the info;
The info kong ();//empty a sequence table
Void the Scanf (info * L);//to the order of input to input data in the table
Void printflist (info * L);//this function is a function for the output of the
Int main ()
{
The info A=kong ();//define a sequence table!
The Scanf (& amp; A);//to the order of input to input data in the table
Printflist (& amp; A);
return 0;
}
Info kong ()//empty a sequence table
{
The info L;
L.l ength=0;
Return the L;
}
Void the Scanf (info * L)//input to input the data in the table to order
{
If (L - & gt; Length==M)
{
Printf (" sequence in the table is full, can't be input ");
exit(1);
}
Char ch=0;
While (1)
{
Printf (" please enter the student achievement: ");
The scanf (" % d ", & amp; L-> Students [L - & gt; length]. Score);
Printf (" please enter the student's student id: ");
The scanf (" % d ", & amp; L-> Students [r]. L - & gt; length number);
L-> Length++;
getchar();
Printf (" whether to continue the input? (Y | | N) : ");
The scanf (" % c ", & amp; Ch);
If (ch=='y' | | ch=='y')
{
}
The else
{
break;
}
}
}//this function is for data input and prepare
Void printflist (info * L)//this function is a function for the output of the
{
int i;
For (I=0; I & lt; L-> length; I++)
{
Student's student id: printf (" % d, achievement: % d \ n ", L - & gt; Students [I] number, L - & gt; Students [I] score);
}
}
CodePudding user response: