填空题
如下程序定义了“单词”类word,类中重载了<运算符,用于比较“单词”的大小,返回相应的逻辑值。程序的输出结果为:After Sorting: Happy Welcome,请将程序补充完整。
#include
#include
using namespace std;
class Word{
public:
Word(string s) : str(s) { }
string getStr1{ return str; }
【14】 const { return (str2{
Word w1(“Happy”),w2(“Welcome”);
Cout<<”After sorting: “;
if(w1
【正确答案】
1、bool operator < (Word w)
【答案解析】