用C++风格编写,输入3个字符串,按由小到大顺序输出。

日期:2016-02-05 08:16:41 人气:2

用C++风格编写,输入3个字符串,按由小到大顺序输出。

#include using namespace std; int main(void) { char n[4]; while (cin >> n) { if (n[0] > n[1]) swap(n[0], n[1]); if (n[1] > n[2]) swap(n[1], n[2]); if (n[0] > n[1]) swap(n[0], n[1]); cout << n[0] << '
    A+
热门评论