Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ PROGRAM write a program for thermocouple.this devices uses a voltage to calc

ID: 3670729 • Letter: C

Question

C++ PROGRAM

write a program for thermocouple.this devices uses a voltage to calculate tempreture.use a namespace containing voltage and temperature float variables.

include in this namespace,three function:

1. GetV()-asks the user for the voltage.

2. calculateT()-calculates the temperature using the formula T=a*V+b

                 where a and b are constants withing the namespace

use a is 12.41 and b is 40.01

3. Display ()-prints the temperature

These three functions have no parameters.

include a non-namespace function also called display which prints a message:

      "This program calculates the temperature from voltage."

your program should display the message,then ask for voltage ,find the temperature and display it.

Explanation / Answer

//hi
//write a program for thermocouple

#include <iostream>
//using namespace std;

float voltage; // Global variables are defined outside of all the functions
float V= voltage;

//calculates the temperature using the formula
float calculateT()
{
float a = 12.41;
float b = 40.01;

float Temp;
Temp = (a*V) + b;     //T=a*V+b
cout <<" The temperature is: " << Temp << endl;
return 0;
}

// asks the user for the voltage.
float GetV()
{

cout << " Please enter the voltage: "; // to get voltage

cin >> voltage; // cin is used in conjunction with the stream extraction operator
   cout << " The voltage is: " << voltage << endl;
return 0;
}

int main()
{
cout << " Program for thermocouple ";
GetV();
calculateT();
return 0;
}

// for checking float voltage =10;// if you give 10 as a input ,your output

//the Sample output for voltage =10
/*
Program for thermocouple

Please enter the voltage:
The voltage is: 10

The temperature is: 164.11

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote