C/C++の宿題片付けます 154代目
■ このスレッドは過去ログ倉庫に格納されています
0295292
2011/12/06(火) 12:22:57.74int aaa(const void *a, const void *b);
int i;
int *j;
typedef struct {
double abc;
double def;
double ghi;
} ponta;
int main(void){
ponta datee[10]={
{ 8, 4, 3 },
{ 6., 1, 7 },
{ 2, 2, 1 },
{ 5, 9, 6 },
};
qsort(datee, 3, sizeof(double), aaa);
for (i=0; i<=3; i++){
printf("%.1lf %.1lf %.1lf\n",datee[i]);}
return 0;}
int aaa(const void *a, const void *b){
if (*(double*)a<*(double*)b) return -1;
else if (*(double*)a == *(double*)b) return 0;
else return 1;}
■ このスレッドは過去ログ倉庫に格納されています