Example #1
0
int main(){
    
	char unit;
	double temp;
	char ans;
	Temperature T;

	do{
	cout << "Please enter the temperature unit (Celsius = C, Kelvin = K, Fahrenheit = F): " << endl;
	cin >> unit;
	cout << "Please enter the temperature given the unit you entered previously: " << endl;
	cin>>temp;
	if (unit == 'C' || unit == 'c')
	{T.setTempCelsius(temp);}
	if (unit == 'F' || unit == 'F')
	{T.setTempFahrenheit(temp);}
	if (unit == 'K' || unit == 'K')
	{T.setTempKelvin(temp);}
	
	T.ShowResult();
	cout << "Re-calculate?" <<endl;
	cin>>ans;
	}while(ans=='Y'|| ans =='y');
	

}
Example #2
0
bool test4() {
    Temperature temperature;
    temperature.setTempKelvin(300);
    return roundl(temperature.getTempFahrenheit()) == 80;
};
Example #3
0
bool test0() {
    Temperature temperature;
    temperature.setTempKelvin(50);
    return temperature.getTempKelvin() == 50;
};