Typedef struct
{
Int number;
} sort;
Int main ()
{
Int I, j, k, temp;
Sort sor [10].
Sort * p;
Printf (" please enter the number 10: \ n ");
for(i=0; i<10; I++)
The scanf (" % d ", & amp; Sor [I] number);
for(i=0; i<9. I++)
{
K=I;
for(j=i+1; J<10; J++)
If (sor [I] number> Sor [j]. Journal of number)
K=j;
If (I.=k)
{
Temp=sor [I] number;
Sor [I] number=sor [j]. Journal of number;
Sor [j]. Journal of number=temp;
}
}
Printf (" \ n as a result of selection sort, \ n ");
For (p=sor. p
return 0;
}
CodePudding user response:
Wrong see mark, for your reference:# include
Typedef struct
{
Int number;
} sort;
Int main (int arg c, char * argv [])
{
Int I, j, k, temp;
Sort sor [10].
Sort * p;
Printf (" please enter the number 10: \ n ");
for(i=0; i<10; I++)
The scanf (" % d ", & amp; Sor [I] number);
for(i=0; i<10; I++)//(I=0; i<9. I++)
{
K=I;
for(j=i+1; J<10; J++)
If (sor [k]. Number> Sor [j]. Journal of number)//(sor [I] number> Sor [j]. Journal of number)
K=j;
If (I.=k)
{
Temp=sor [I] number;
Sor [I] number=sor [k]. Number;//sor [I] number=sor [j]. Journal of number;
Sor [k]. Number=temp;//sor [j] number=temp;
}
}
Printf (" \ n as a result of selection sort, \ n ");
For (p=sor. pPrintf (" % 5 d ", p - & gt; Number);
system("pause");
return 0;
}