Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么错求解释#include<iostream> #include<string> using namespace std; struct Index{ int a; string str; }; int Inorder(string,int); int main(){ int first,second; cin>>first>>second; Index DNA[second]; Index temp; int find[second]; for(int i=0;i<second;i++){ cin>>DNA[i].str; } for(int i=0;i<second;i++){ DNA[i].a = Inorder(DNA[i].str,first); } for(int i=0;i<second;i++){ for(int j=i+1;j<second;j++){ if(DNA[i].a>DNA[j].a){ temp = DNA[i]; DNA[i] = DNA[j]; DNA[j] = temp; } } } for(int i=0;i<second;i++){ cout<<DNA[i].str<<endl; } cin>>first; system("pause"); return 0; } int Inorder(string str,int le){ int count; count = 0; for(int p=0;p<le;p++){ for(int q=p+1;q<le;q++){ if(str[p]>str[q]) count++; } } return count; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator