[ create a new paste ] login | about

Link: http://codepad.org/exDYBYEL    [ raw code | output | fork ]

C++, pasted on Oct 14:
#include<stdio.h>
typedef struct{
int id;
double height;
int weight;
} 
list;
int main(void){
list data[]={
{1,165,60},
{2,170,68},
{3,160,50},
{4,180,75},
{5,175,80},
};
for(int i=0; i<4;i++){
for(int j=i+1; j<5; j++){
if(data[i].height<data[j].height){
list tmp=data[i];
data[i]=data[j];
data[j]=tmp;
}
}
}
for(int k=0; k<5; k++){
printf("%d %f %d\n", data[k].id, data[k].height, data[k].weight);
}
return 0;
}


Output:
1
2
3
In function 'int main()':
Line 9: error: reference to 'list' is ambiguous
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: