美文网首页
[C++ Primer] 练习3.4

[C++ Primer] 练习3.4

作者: 和平北路 | 来源:发表于2017-02-28 11:43 被阅读0次
#include <iostream>
#include <string>

using std::string;
using std::cout;
using std::cin;
using std::endl;

int main() {
    string first;
    string second;

    cin >> first >> second;
    if (first > second) {
        cout << first << endl;
    } else if (first < second) {
        cout << second << endl;
    }

    if (first.size() > second.size()) {
        cout << first << endl;
    } else if (first.size() < second.size()) {
        cout << second << endl;
    }
}

相关文章

网友评论

      本文标题:[C++ Primer] 练习3.4

      本文链接:https://www.haomeiwen.com/subject/rmrxgttx.html