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; int main() { string s[4]; int a[26]; int max=-1;; for(int c=0 ; c<26; c++) a[c] =0; for(int k =0; k<4; k++) getline(cin,s[k]); for(int i =0; i<4; i++) for(int j =0; j<s[i].length(); j++) { if((int(s[i][j])-65)>=0&&(int(s[i][j])-65)<26); a[int(s[i][j])-65]++; }//统计每个字符出现的次数 for(int p =0; p<26; p++) { if(max<a[p]) max =a[p]; }//找出字符出现频率的最大值 //cout<<max<<endl; for(int pp=max; max>0; max--) { for(int cc=0; cc<26; cc++) { if(a[cc]>=max) cout<<"* "; else cout<<" "; } cout<<endl; } for(int ccc=0; ccc<26; ccc++) cout<<char(65+ccc)<<" "; system("PAUSE"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator