// Assignment operator Species& Species::operator=(const Species& s) { if (&s == this) return *this; thermoFormatType = s.thermoFormatType; name = s.name; id = s.id; phase = s.phase; tlow = s.tlow; tmid = s.tmid; thigh = s.thigh; nTempRegions = s.nTempRegions; elements = s.elements; comp = s.comp; lowCoeffs = s.lowCoeffs; highCoeffs = s.highCoeffs; delR(); int iReg = s.region_coeffs.size(); for (int i = 0; i < iReg; i++) { region_coeffs.push_back(new vector_fp(*(s.region_coeffs[i]))); } minTemps = s.minTemps; maxTemps = s.maxTemps; m_commentsRef = s.m_commentsRef; valid = s.valid; index = s.index; return *this; }
main(){ int i, j, opt, opt2, opt3, nRuang, nLantai=3; for(i=0; i<nLantai; i++){ addL(i+1); if(i==0) nRuang=5; else if(i==1) nRuang=2; else nRuang=3; for(j=0; j<nRuang; j++) addR(i+1); } while(true){ printf("Menu:\n1. tambah ruang\n2. hapus ruang\n3. pinjam ruang\n4. kembalikan ruang\n5. lihat ruang\n6. lihat ruang yang dipinjam\n7. tambah lantai\n8. hapus lantai\n9. exit\noption : "); scanf("%d",&opt); if(opt==1) { printf("tambah ke lantai : "); scanf("%d",&opt2); nRuang++; addR(opt2); viewL(true); } else if(opt==2){ printf("delete ruang terakhir pada lantai : "); scanf("%d",&opt2); delR(opt2); viewL(true); } else if(opt==3 || opt==4){ printf("Pilih lantai : "); scanf("%d",&opt2); printf("Pilih ruang : "); scanf("%d",&opt3); if(opt==3) status(opt2, opt3, 1); else status(opt2, opt3, 0); viewL(false); } else if(opt==5) viewL(true); else if(opt==6) viewL(false); else if(opt==7){ nLantai++; addL(nLantai); viewL(true); } else if(opt==8){ nLantai--; delL(); viewL(true); } else break; } getch(); }
// Destructor Species::~Species() { delR(); }