#10702. 字符处理第八题(NOIP2011)

字符处理第八题(NOIP2011)

第八题(NOIP2011)

#include<iostream>
#include<string>
using namespace std;
int main() {
    string map = "22233344455566677778889999";
    string tel;
    int i;
    cin >> tel;
    for (i = 0; i < tel.length(); i++) {
        if ((tel[i] >= '0') && (tel[i] <= '9')) {
            cout << tel[i];
        } else if ((tel[i] >= 'A') && (tel[i] <= 'Z')) {
            cout << map[tel[i] - 'A'];
        }
    }
    cout << endl;
    return 0;
}
  1. 【判断题】第7行输入的字符串可以是任意字符,包括字母、数字、各类符号甚至中文汉字及符号。 {{ select(1) }}
  • 正确
  • 错误
  1. 【判断题】如果去掉第13行,程序无运行错误。 {{ select(2) }}
  • 正确
  • 错误
  1. 【判断题】输出结果可以包含大写字母。 {{ select(3) }}
  • 正确
  • 错误
  1. 【判断题】输出的字符串至多包含8种不同数字。 {{ select(4) }}
  • 正确
  • 错误
  1. 【选择题】输入CCF-NOIP-2011,输出的结果是( )。 {{ select(5) }}
  • 22366472011
  • 223-6647-2011
  • 22366462011
  • 22366482011
  1. 【选择题】输入WELCOME-CSP,输出的结果是( )。 {{ select(6) }}
  • 9352663277
  • 9342663277
  • 9342663278
  • 9342663377