#CS40208. 阅读程序2-字符处理-08
阅读程序2-字符处理-08
阅读程序
注意:切勿用电脑直接运行代码得出答案,请用大脑+笔+纸运行代码答题,否则是在浪费你的时间。
第2节:字符处理
第8题【NOIP】2011
#include<iostream>
#include<string>
using namespace std;
int main() {
string map= "2223334445556667778889999";
string tel;
07 int i;
cin>>tel;
for(i=0; i<tel.length(); i++)
if((tel[i]>='0') && (tel[i]<='9') )
cout<<tel[i];
else
13 if( (tel[i]>='A') && (tel[i]<='Z'))
cout<<map[tel[i]-'A'];
cout<<endl;
return 0;
}
●判断题
(1)第7行输人的字符事可以是任意字符,包括字母、数字、各类符号甚至中文汉字及符号()
{{ select(8-1) }}
- 对
- 错
(2)如果去掉第13行,程序无运行错误。
{{ select(8-2) }}
- 对
- 错
(3)输出结果可以包含大写字母。
{{ select(8-3) }}
- 对
- 错
(4)输出的字符串至多包含8种不同数字
{{ select(8-4) }}
- 对
- 错
●选择题
(5)输人CCF-NOIP-2011,输出的结果是( )。
{{ select(8-5) }}
- 22366472011
- 223-6647-2011
- 22366472011
- 22366482011
(6)输入 WELCOME-CSP,输出的结果是( )。
{{ select(8-6) }}
- 9352663277
- 9342663277
- 9342663278
- 9342663377