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;
}

posted @ 2016-04-10 20:28  Jarning_Gau  阅读(2038)  评论(0编辑  收藏  举报