/*L*/

/*[‚bŒ¾Œê]ƒTƒ“ƒvƒ‹ƒvƒƒOƒ‰ƒ€W@Šî–{‘I‘ð–@ƒ\[ƒX‚R*/

/*–ÚŽŸ‚Ö–ß‚é*/

#include <stdio.h> struct PLAYER{ char *name; int num; }; struct PLAYER set_data(char *, int); void my_sort2(struct PLAYER *, int); int main(){ struct PLAYER player[5]; int i; player[0] = set_data("“c’†", 5); player[1] = set_data("—é–Ø", 1); player[2] = set_data("²“¡", 3); player[3] = set_data("Ö“¡", 4); player[4] = set_data("“n•Ó", 2); for (i = 0; i < 5; i++){ printf("%s %d\n", player[i].name, player[i].num); } printf("\n"); my_sort2(player, sizeof(player) / sizeof(struct PLAYER)); for (i = 0; i < 5; i++){ printf("%s %d\n", player[i].name, player[i].num); } return 0; } struct PLAYER set_data(char *name, int num){ struct PLAYER tmp; tmp.name = name; tmp.num = num; return tmp; } void my_sort2(struct PLAYER *ary, int size){ struct PLAYER tmp; int i, j; for (i = 0; i < size - 1; i++){ for (j = i + 1; j < size; j++){ if ((ary + i)->num >(ary + j)->num){ tmp = *(ary + i); *(ary + i) = *(ary + j); *(ary + j) = tmp; } } } }

/*ƒy[ƒW‚̐擪‚Ö*/

/*–ÚŽŸ‚Ö–ß‚é*/

/*HOME*/

/*Copyright 2016 K.N/petitetech.com*/

/*L*/