// Program to demonstrate Temperature class //----------------------------------------- int main() { Temperature freezing; Temperature boiling; Temperature coldcold; Temperature hothot; freezing.setCelsius(0); boiling.setCelsius(100); coldcold.setCelsius(-500); hothot.setCelsius(20000000); cout << "freezing: " << freezing.getFahrenheit() << "F\n"; cout << "boiling: " << boiling.getFahrenheit() << "F\n"; cout << "coldcold: " << coldcold.getCelsius() << "C\n"; cout << "hothot: " << hothot.getCelsius() << "C\n"; return 0; }
int main() { Temperature outside = Temperature(); outside.set_fahrenheit(0.0); Temperature inside = Temperature(273.15); cout << "Outside F: " << outside.getFahrenheit() << endl; cout << "Outside K: " << outside.getKelvin() << endl; cout << "Inside F: " << inside.getFahrenheit() << endl; cout << "Inside K: " << inside.getKelvin() << endl; // cout << (outside + 5).getFahrenheit() << endl; // Temperature both = outside + inside; // cout << both.getFahrenheit() << endl; // cout << both.getKelvin() << endl; cout << (outside + inside).getFahrenheit() << endl; cout << (outside + inside).getKelvin() << endl; return 0; }