标签:
nefu 1026
http://acm.nefu.edu.cn/JudgeOnline/problemShow.php?problem_id=1026
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> using namespace std; struct node { char str[55]; } data[25]; bool cmp(const node &a,const node &b) { if(strcmp(a.str,b.str)<0) return true; else return false; } int main() { int n; node *p,tmp; while(cin>>n) { for(int i=0;i<n;i++) { p=(struct node *)malloc(sizeof(struct node)); cin>>p->str; strcpy(data[i].str,p->str); } sort(data,data+n,cmp); for(int i=0;i<n;i++) cout<<data[i].str<<endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/nefu929831238/p/5440817.html