void readBeam(istream & theStream, string & beam) { string beamType; theStream >> beamType; if (beamType == "I-beam" || beamType == "C-channel" || beamType == "flitch" ||beamType == "cantilever" || beamType == "hip") beam= beamType; else { theStream.seekg(-beam.size(), ios::cur); // unread the word theStream.setstate(ios::failbit); // indicate failure } }