[ create a new paste ] login | about

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

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


Output:
1
2
3
In function 'int main()':
Line 30: error: expected `}' at end of input
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: