以下程序统计从终端输入的字符中大写字母的个数 ,num[0] 中统计字母 A 的个数 ,num[1] 中统计字母的个数 , 其它依次类推 . 用 # 号结束输入 , 请填空 .
#include
#include
main()
{ int num[26]={0},i; char c;
while(( _[16]_______ )!='#')
if(isupper(c)) num[c- ' A ' ]+= _[17]_______ ;
for(i=0;i<26;i++)
Printf("%c:%d\n",i+'A',num[i]);
}
相关专题: 大写字母
相关问题推荐
A.PrivateSubText1_KeyPress(KeyAsciiAsIntegeIfKeyAscii<65OrKeyAscii>90ThenMsgBox“请输入大写字母”KeyAscii=0EndIfEndSub
B.PrivateSubText1_KeyDown(KeyCodeAsInteger,ShiftAsIntegeIfKeyCode<65OrKeyCode>90ThenMsgBox“请输入大写字母”KeyCode=0EndIfEndSub
C.PrivateSubText1MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingl,IfAsc(Text1.Tex<65OrAsc(Text1.Tex>90ThenMsgBox“请输入大写字母”EndIfEndSub
D.PrivateSubText1_Change()IfAsc(Text1.Tex>64AndAsc(Text1.Tex<91ThenMsgBox“请输入大写字母”EndIfEndSub
在窗体上画一个名称为Text1的文本框,要求文本框只能接收大写字母的输入。以下能实现该操作的事件过程是()。
A.Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii<65 Or KeyAscii>90 Then
MsgBox "请输入大写字母"
KeyAscii=0
End If
End Sub
B.Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode <65 Or KeyCode>90 Then
MsgBox "请输入大写字母"
KeyCode=0
End If
End Sub
C.Private Sub Text1_MouseDown(Button As Integer,_
Shift As Integer, X As Single, Y As Single)
If Asc(Text1.Text) <65 Or Asc(Text1.Text) >90 Then
MsgBox "请输入大写字母"
End If
End Sub
D.Private Sub Text1_Change()
If Asc(Text1.Text) >64 And Asc(Text1.Text) <91 Then
MsgBox "请输入大写字母"
End If
End Sub
注意:请勿改动main()主方法和其他已有语句内容,仅在下划线处填入适当的语句。
程序运行结果如下:
输入一个大写字母串:ADFSDFFE
加密后的大写字母串:ZWUHWUUV
importjava.io.*;
publicclassex12_2
publicstaticvoidmain(String[]args)
charch=’A’;
Stringstr;
System.out.print("输入一个大写字母串:");
try
BufferedReaderin=newBufferedReader(newInputStreamReader(System.in));
str=in.readLine();
System.out.print("加密后的大写字母串:");
for(inti=0;i<str.length();i++)
_______________;
_______________;
System.out.print(ch);
catch(IOExceptione)
try
System.in.read();
catch(IOExceptione);
各种计算机中,字符的ASCII码不完全相同。但是对英文26个字母而言,其大写字母与小写字母的序号的是相同的。下面的说法正确的是()。
A、大写字母的序号依次为97~122
B、小写字母的序号依次为97~122
C、大写字母的序号依次为1~26
D、小写字母的序号依次为1~26