📄 key.h
字号:
// Definition of a Key class:
class Key
{ public:
static int comparisons;
Key(int x=0)
{ key = x; }
int the_key( ) const{ return key; }
Key& operator=(const int x)
{ key = x; return *this; }
Key& operator=(const Key& copy)
{ key = copy.key; return *this; }
protected:
int key;
};
int Key::comparisons = 0;
bool operator==(const Key &x, const Key &y)
{ Key::comparisons++;
return x.the_key( ) == y.the_key( );
}
bool operator>(const Key &x, const Key &y)
{ Key::comparisons++;
return x.the_key( ) > y.the_key( );
}
bool operator>=(const Key &x, const Key &y)
{ Key::comparisons++;
return x.the_key( ) >= y.the_key( );
}
bool operator<(const Key &x, const Key &y)
{ Key::comparisons++;
return x.the_key( ) < y.the_key( );
}
bool operator<=(const Key &x, const Key &y)
{ Key::comparisons++;
return x.the_key( ) <= y.the_key( );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -