| ||||||||||
| 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 | |||||||||
无限PE?求解释。#include<iostream>
using namespace std;
char a[75];
char b[75];
char c[75];
char d[75];
int result[26];
char *alpha="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
int main()
{
int i,max;
memset(result,0,sizeof(result));
gets(a);
gets(b);
gets(c);
gets(d);
for(i=0;a[i]!='\0';i++)
if(a[i]!=' ')
result[a[i]-'A']++;
for(i=0;b[i]!='\0';i++)
if(b[i]!=' ')
result[b[i]-'A']++;
for(i=0;c[i]!='\0';i++)
if(c[i]!=' ')
result[c[i]-'A']++;
for(i=0;d[i]!='\0';i++)
if(d[i]!=' ')
result[d[i]-'A']++;
for(i=0,max=0;i<26;i++)
if(result[i]>max)
max=result[i];
for(;max>0;max--)
{
for(i=0;i<=25;i++)
{
if(result[i]>=max)
printf("*");
else
printf(" ");
if(i!=25)
printf(" ");
}
printf("\n");
}
puts(alpha);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator