C++: Need help to make a program that returns gas temp in Celsius. The electric
ID: 3746004 • Letter: C
Question
C++: Need help to make a program that returns gas temp in Celsius.
The electric circuit shown below is designed to measure the temperature of the gas in a chamber Rs = 75 11.43 V Voltmeter o The resistor R represents a temperature sensor enclosed in the chamber. The resistance R, in , is related to the temperature T, in °C, by the equation In this device, assume Ro-100 and k-05. The voltmeter displays the value of the voltage, Vm , across the sensor. This voltage Vm indicates the temperature, T, of the gas according to the equation Suppose the voltmeter voltage is constrained to the range Vmin 12 volts s VmE Vmax 18 volts. Write a program that accepts a value of Vmand checks that it's between 12 and 18. The program should return the gas temperature in degrees Celsius when V is between 12 and 18 and an error message when it isn't.Explanation / Answer
#include<iostream>
using namespace std;
float convert (float);
int main()
{
float gas, celsius; //variables for stroing given input and output
cout << "enter temperature in of gas ";
cin >>gas;
celsius=convert(gas); //function call and return to main
cout<<"temperature in celsius " << celsius << endl; //output
return 0;
}
float convert(float gas)
{
return (gas-32)*5/9; //formula to convert into celsius;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.