pascal题目,速度~~~

来源:百度知道 编辑:UC知道 时间:2024/07/04 15:46:06
从一个文本文件 count.in中的文章中统计英文字母出现的次数,不考虑大小写和标点符号。
提示使用eoln 和eof
快···

输出在'count.out'
var c:char;
s:array[1..26]of integer;
begin
assign(input,'count.in');
reset(input);
assign(output,'count.out');
rewrite(output);
repeat
repeat
read(c);
if (ord(c)=13)or(ord(c)=10) then break;
if c in ['a'..'z'] then s[ord(c)-96]:=s[ord(c)-96]+1;
if c in ['A'..'Z'] then s[ord(c)-64]:=s[ord(c)-64]+1;
until eoln;
readln;
until oef;
for i:=1 to 26 do
writeln(chr(i+96),':',s[i]);
end.