| ||||||||||
| 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.h>
#include<string.h>
#include<stdio.h>
void main()
{
int n,m;
cin>>n>>m;
char s[100][50];
int temp[50];
char stemp[50];
for(int i=0;i<m;i++){
cin>>s[i];
temp[i]=0;
for(int j=0;j<n;j++)
for(int k=j+1;k<n;k++){
if(s[i][j]>s[i][k]) ++temp[i];
}
}
int m1=m-1;
int t;
for(i=0;i<m-1;i++){
for(int j=0;j<m1;j++){
if(temp[j]>temp[j+1]){ t=temp[j+1];temp[j+1]=temp[j];temp[j]=t;strcpy(stemp,s[j]);strcpy(s[j],s[j+1]);strcpy(s[j+1],stemp);}
}
--m1;
}
for(i=0;i<m;i++)
cout<<s[i]<<"\n";
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator