Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

无论如何都看不出哪里有错,请高手指点

Posted by shitfuck at 2005-03-01 13:30:39 on Problem 2136
#include <iostream.h>


void main()
{
char szLetters[4][73];
for (int i=0;i<4;i++){
	cin.getline(szLetters[i],73);
}

int nSta[26];
for (int j=0;j<26;j++)
    nSta[j]=0;
for (i=0;i<4;i++){
	for (int j=0;j<72;j++){
		if (szLetters[i][j]>='A'&&szLetters[i][j]<='Z')
		nSta[szLetters[i][j]-'A']++;
	}
}

int nMaxFrequency=0;
for (int k=0;k<26;k++){
	if (nSta[k]>=nMaxFrequency)
		nMaxFrequency=nSta[k];
}
int nCurrentFrequency=nMaxFrequency;
for (;nCurrentFrequency>0;nCurrentFrequency--){
	for (int l=0;l<25;l++){
		if (nSta[l]>=nCurrentFrequency){
			cout <<"* ";
		}
		else
			cout <<"  ";
	}
	if (nSta[25]>=nCurrentFrequency)
		cout << "*\n";
	else
		cout << "\n";
}
	cout <<"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";


}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator