Roy*_*Dan 5 c++ string comparison stdstring
#include "stdafx.h"
#include "iostream"
#include "string"
using namespace std;
void main()
{
string a = "a";
string b(1, -70); /*constructor, create a string having 1 character that its value is equal to -70*/
cout << (b > a ? b : a);
}
//output on screen: b was printed, not a (!)
Run Code Online (Sandbox Code Playgroud)
虽然b的值小于a的值,为什么b>a?我该如何纠正这种情况?
| 归档时间: |
|
| 查看次数: |
770 次 |
| 最近记录: |