/*exp3_1.cpp*/ #include <string> #include <iostream> #include "1.h" void main() { welcome we; welcome you(we); you.Display(); you.set("How are you?"); cout<<you.Get()<<endl; you.talk(); you.Display(); } /*exp3_1.h*/ using namespace std; class welcome { public: welcome(){} welcome(string _str) { this->str = _str; } void set(string _str) { this->str = _str; } string Get() { return this->str; } void talk() { char _str[200]; cin.getline(_str, sizeof(_str)); this->str = string(_str); } void Display() { if(this->str.compare("OK") == 0) { cout<<"Aright!/nGoodbye!/nOK!/nGoodbye!/nGoodbye!"<<endl; } else cout<<str<<endl; } private: string str; };