// copyright 1999 Brian J. Reithel, Ph.D. #include #include class building { char name[151]; float sqfeet; public: void info_in(void); void info_out(void); char* getname(void); float getsqfeet(void); }; char* building::getname(){ return(name); } float building::getsqfeet(){ return(sqfeet); } void building::info_in(){ cout << "Enter the building name: "; cin.get(name,150,'\n'); char nl; cin.get(nl); cout << "Enter the size in square feet: "; cin >> sqfeet; cin.get(nl); } void building::info_out(){ cout << "Building: " << name << endl; cout << "Size: " << sqfeet << endl; } int main() { building onebldg; onebldg.info_in(); onebldg.info_out(); fstream outfile; outfile.open("building.dat",ios::out); outfile << onebldg.getname() << endl; outfile << onebldg.getsqfeet() << endl; outfile.close(); return(0); }