| ||||||||||
| 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 | |||||||||
求解释~runtime error 怎么修改啊#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char telenumber[1000][9],str[20];
char replace[]="2223334445556667777888999";//使用全局变量
int compare(const void *e1,const void *e2)
{
return(strcmp((char*)e1,(char*)e2));
}
void stand(int n)
{
int i=0,j=0;//i表示输入字符串的顺序,j表示新的字符串的顺序
while(j<8){
if(str[i]='-')
{
i++;
continue;}
if(j==3){
telenumber[n][3]='-';
j++;
continue;}
telenumber[n][j]=str[i];
i++;j++;
}
telenumber[n][j]='\0';
}
int main()
{
int i,j,n,k=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%s",str);
stand(i);//变成标准格式
}
qsort(telenumber,n,9,compare);//使用库函数进行排序
i=0;
while(i<n){
j=i;
i++;
while(i<n&&strcmp(telenumber[i],telenumber[j])==0)
i++;
if(i-j>1){
printf("%s%d\n",telenumber[j],i-j);
k=1;
}
}
if(k==0)
printf("No duplicates.\n");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator