#include using namespace std; class TV { public: friend class Tele; TV():on_off(off),volume(20),channel(3),mode(tv){} private: enum{on,off}; enum{tv,av}; enum{minve,maxve=100}; enum{mincl,maxcl=60}; bool on_off; int volume; int channel; int mode; }; class Tele { public: void OnOFF(TV&t){t.on_off=(t.on_off==t.on)?t.off:t.on;} void SetMode(TV&t){t.mode=(t.mode==t.tv)?t.av:t.tv;} bool VolumeUp(TV&t); bool VolumeDown(TV&t); bool ChannelUp(TV&t); bool ChannelDown(TV&t); void show(TV&t)const; }; bool Tele::VolumeUp(TV&t) { if (t.volumet.minve) { t.volume--; return true; } else { return false; } } bool Tele::ChannelUp(TV&t) { if (t.channelt.mincl) { t.channel--; return true; } else { return false; } } void Tele::show(TV&t)const { if (t.on_off==t.on) { cout<<"电视现在"<<(t.on_off==t.on?"开启":"关闭")<