📄 d_state.h
字号:
#ifndef STATECITY_CLASS
#define STATECITY_CLASS
#include <iostream>
#include <string>
using namespace std;
// object stores the state name and city in the state
class stateCity
{
public:
stateCity (const string& name = "", const string& city = ""):
stateName(name), cityName(city)
{}
// output the state and city name in the format
// cityName, stateName
friend ostream& operator<< (ostream& ostr, const stateCity& state)
{
ostr << state.cityName << ", " << state.stateName;
return ostr;
}
// operators < and == must be defined to use with set object.
// operators use only the stateName as the key
friend bool operator< (const stateCity& a, const stateCity& b)
{
return a.stateName < b.stateName;
}
friend bool operator== (const stateCity& a, const stateCity& b)
{
return a.stateName == b.stateName;
}
private:
string stateName, cityName;
};
#endif // STATECITY_CLASS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -