c++中的string 中对象的大小比较


 1 #include<iostream>
 2 using namespace std;
 3 
 4 int main()
 5 
 6 {
 7 
 8 string str1=("124");
 9 string str2=("531");
10 string str3="1234";
11 bool answer;
12 answer=str1>str2;
13 cout<<answer<<endl;    //0   从第一个不同的数字或者字母比较大小
14 
15 answer=str3>str1;    
16 cout<<answer<<endl;     //0
17 answer=str2>str3;
18 cout<<answer<<endl;      //1
19 return 0;
20 
21 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM