Question: slove using this code #include using namespace std; int main() { // Declaring constants const int tref = 20; // Declaring variables int rref, t;

slove using this code
#include
using namespace std;
int main()
{
// Declaring constants
const int tref = 20;
// Declaring variables
int rref, t;
char ch;
double tempCoeff, R;
// Getting the input entered by the user
cout
cin >> rref;
cout
cin >> t;
/* This while loop continues to execute
* until the user enters a valid character
*/
while (true)
{
cout
cout
cout
cout
cout
cin >> ch;
switch (ch)
{
case 'a':
{
tempCoeff = 0.005866;
break;
}
case 'b':
{
tempCoeff = 0.004041;
break;
}
case 'c':
{
tempCoeff = 0.003819;
break;
}
case 'd':
{
tempCoeff = 0.003715;
break;
}
default:
{
cout
continue;
}
}
break;
}
// Calculating the conductor resistance at Temperature T
R = rref * (1 + tempCoeff * (t - tref));
// Displaying the output
cout
system("pause");
return 0;
}
Font Paragraph R = Rref [1 + a(T-Tref)] In this formula: R is the conductor resistance at temperature T (in ohms) Ref is the resistance at reference temperature (in ohms) T is the operating temperature in degrees Celsius Tref is the reference temperature, Tief 20C a is the temperature coefficient of resistance for the conductor material . . . . As in the Task 1, get user entered values for Rre and T, and set the value of Traf to 20C. Using either switch or if else statement, allow the user to choose from one of the following four conductors: iron, copper, silver or gold. You must demonstrate your knowledge of functions: to obtain the value of the temperature coefficient a, you must store each of the values for a in a function, using one for each of the four conductors on offer. The temperature coefficient values are: Iron Copper Silver Gold a 0.005866 a = 00.4041 a= 0.003819 a = 0.003715 When users choice of the conductor type is received in the main0, retrieve the value for a from the corresponding function, return it to the mainO and use it to calculate R, printing the result ton the console screen Note: You are encouraged to reuse the code developed in Task 1. To demonstrate your knowledge of the development environment in use, answer the following In your code, you may use void or int as the retum value of your main0. Which one did you use? Explain the difference between these two choices, (Ctrl)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
