c++中string类型可以直接进行比较

以下代码在Ubuntu14.10下实现

/*-------------------------
filename is demo.cpp
--------------------------*/
#include <iostream>
using namespace std;
int main(){
    string str1="abcde";
    string str2="bdewqf";
    if(str1<str2)
        cout<<str1<<endl;
    else
        cout<<str2<<endl;
}

原文地址:https://www.cnblogs.com/JarningGau/p/5375325.html