#include
struct sell
{
char dm[4];
char mc[10];
int dj;
int sl;
long int je;
}sell[100];
void main()
{
int i,j,t;
long int m;
for(i=0;i
scanf("%s,%s,%4d,%5d,%5d\n",&sell[i]dm,&sell[i].mc,&sell[i].dj,&sell[i].sl,&sell[i].je);
for(i=0;i
for(i=0;i
if(struct(sell[i].mc>sell[i+1].mc)
{
t=sell[i].mc;
sell[i].mc=sell[i+1].mc;
sell[i+1].mc=t;
}
else if(sell[i].mc==sell[i+1].mc)
{
if(sell[i].je>sell[i+1].je)
{
m=sell[i].je;
sell[i].je=sell[i+1].je;
sell[i+1].je=m;
}
}
for(i=0;i<100;i++)
printf("%s,%s,%4d,%5d,%5d\n",sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je);
}
錯誤多著呢
&sell[i]dm
中間少了點
struct(sell[i].mc>sell[i+1].mc
這裡多了struct(