关于ACM的一道题,无法通过编译,求大神!
题目在这:http://acmoj.shu.edu.cn/openjudge/viewproblem.php?coll_id=1&prob_id=10
#include<iostream>#include<string>using namespace std;struct link{ string a; link *next; };void sort(int *temp,int a){ int i,j,pos,tem; for (int i = 0;i < a-1;i++) { pos = i; for (int j = i+1;j < a;j++) { if (*(temp+pos) > *(temp+j)) { pos = j; } } tem = *(temp+pos); *(temp+pos) = *(temp+i); *(temp+i) = tem; }} int main(){ int a,i=0; string p; char q[10]; link *head,*l,*temp; head=l=new link; while(cin>>a) { p=""; int *h=new int[a]; for(i=0;i<a;i++) { cin>>*(h+i); } sort(h,a); for(i=0;i<a;i++) { if(i!=(a-1)) { itoa(*(h+i),q,10); p=p+q+" "; } else { itoa(*(h+i),q,10); p=p+q; } } l->a=p; temp=new link; l->next=temp; temp->next=NULL; l=temp; } while(head->next!=NULL) { cout<<head->a<<endl; head=head->next; } return 0;}