8.17 ZOOM c++ 试题

20道单选 10道不定项 编程题1 1道 编程题2 1道

早知道编程这么简单 就先做编程了

第一题 大小写转换

#include <iostream>
using namespace std;
int main(){
    string str = "";
    getline(cin, str);
    for(auto &it:str)
        if((it >= 'a' && it <= 'z') || (it >= 'A' && it <= 'Z'))
            it ^= ' ';
    cout << str;
    return 0;
}

第二题 格式转换

#include <iostream>
using namespace std;
int main(){
    string str = "", res = "";
    cin >> str;
    for(int i=0; i<str.size(); i+=2)
        res = res + string(str[i+1]-'0', str[i]);
    cout << res << endl;
    return 0;
}
#ZOOM#
全部评论
有道理啊,以后先做编程题
点赞 回复
分享
发布于 2019-08-17 15:31
我第一题一直不能ac啊。。。要炸了。你也是utf-8格式的字符串吗?
点赞 回复
分享
发布于 2019-08-17 15:43
乐元素
校招火热招聘中
官网直投
ac第一道,第二道没时间写啦😭,请问能进面试吗?
点赞 回复
分享
发布于 2022-03-21 20:24

相关推荐

4 10 评论
分享
牛客网
牛客企业服务