输入一串字符,以“?”结束。统计其中字母个数,数字个数,其它符号个数Pascal

program count;
var c:char;
x,y,z:longint;
begin
repeat
read(c);
if c<>'?' then
begin
if (c>='0')and(c<='9') then inc(x)
else if (c>='a')and(c<='z')or(c>='A')and(c<='Z') then inc(y)
else inc(z);
end;
until c='?';
writeln(x,' ',y,' ',z);
end.
x是数字个数,y是字母个数,z是其他字符个数。
没有统计最后一个'?'要统计的话就最后把z加1就可以了
Private Sub Form_Click()
Dim a As String
a1 = 0
a2 = 0
a3 = 0
a = InputBox("请输入字符串,以?号结束")
For i = 1 To Len(a) - 1
c = Mid(a, i, 1)
Select Case Asc(c)
Case 65 To 90, 97 To 122
a1 = a1 + 1
Case 48 To 57
a2 = a2 + 1
Case Else
a3 = a3 + 1
End Select
Next i
Print Left(a, Len(a) - 1)
Print " 字母有" & a1 & "个"
Print " 数字有" & a2 & "个"
Print "其他字符有" & a3 & "个"

End Sub 希望可以帮到你.!
program ihgg;
var i,j,k:integer;p:char;
begin
repeat
read(p);
if p in['0'..'9'] then inc(i)
else if p in['A'..'Z'] then inc(j)
else if p in['a'..'z']then inc(j)
else inc(k);
until p='?';
writeln(i,' ',j,' ',k);
end.
包括“?”