#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 (!)
爲什麼b> a雖然b的值小於a的值, 我該如何糾正這種情況?C++字符串比較
你是從舊的課本中得到這個嗎? – silent 2010-12-23 05:24:35