Question

Can someone convert this to C programming language? #include using namespace std; class phyfor { public:...

Can someone convert this to C programming language?

#include using namespace std; class phyfor { public: void calcH//fucntion to calulate rate of heat transfer { double K,A,T1,T2,X,H; cout<<"Coefficient of thermal conductivity (W/m-K) : "<>K; cout<<"Cross-sectional area of conductor (m^2) : "<>A; cout<<"Temperature on one side (K) : "<>T2; cout<<"Temperature on other side (K) : "<>T1; cout<<"Thickness of conductor (m) : "<>X; H=K*A*(T2-T1)/X; cout<<"Rate of heat transfer (watts) : "<>H; cout<<"Cross-sectional area of conductor (m^2) : "<>A; cout<<"Temperature on one side (K) : "<>T2; cout<<"Temperature on other side (K) : "<>T1; cout<<"Thickness of conductor (m) : "<>X; K=((H*X)/A)*(T2-T1); cout<<"Coefficient of thermal conductivity : "<>H; cout<<"Coefficient of thermal conductivity (W/m-K) : "<>K; cout<<"Temperature on one side (K) : "<>T2; cout<<"Temperature on other side (K) : "<>T1; cout<<"Thickness of conductor (m) : "<>X; A=(H*X)/K*(T2-T1); cout<<"Cross-sectional area of conductor : "<>H; cout<<"Coefficient of thermal conductivity (W/m-K) : "<>K; cout<<"Cross-sectional area of conductor (m^2) : "<>A; cout<<"Temperature on one side (K) : "<>T2; cout<<"Temperature on other side (K) : "<>T1; X=K*A*(T2-T1)/H; cout<<"Thickness of conductor : "<>H; cout<<"Coefficient of thermal conductivity (W/m-K) : "<>K; cout<<"Cross-sectional area of conductor (m^2) : "<>A; cout<<"Temperature on one side (K) : "<>T2; cout<<"Thickness of conductor (m) : "<>X; T1=-(H*X/K*A-T2); cout<<"Temperature on other side : "<>H; cout<<"Coefficient of thermal conductivity (W/m-K) : "<>K; cout<<"Cross-sectional area of conductor (m^2) : "<>A; cout<<"Temperature on one side (K) : "<>T2; cout<<"Thickness of conductor (m) : "<>X; T2=H*X/K*A+T1; cout<<"Temperature on one side : "<>ch; phyfor obj; //object of the class switch(ch) //calling the respective fucntion { case 1: obj.calcH(); break; case 2: obj.calcK(); break; case 3: obj.calcA(); break; case 4: obj.calcT2(); break; case 5: obj.calcT1(); break; case 6: obj.calcX(); break; default: cout<<"Invalid Choice"; break; } return 0; }

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>

int main()
{
double K,A,T1,T2,X,H;
void calcH() //fucntion to calulate rate of heat transfer
{
printf("Coefficient of thermal conductivity (W/m-K) :&d ",K);
printf("Cross-sectional area of conductor (m^2) : &d",A);
printf("Temperature on one side (K) : &d",T2);
printf("Temperature on other side (K) : &d",T1);
printf("Thickness of conductor (m) : &d",X);
H=K*A*(T2-T1)/X;
printf("Rate of heat transfer (watts) : &d",H);
}
void calcK()
{
printf("Cross-sectional area of conductor (m^2) : &d",A);
printf("Temperature on one side (K) : &d",T2);
printf("Temperature on other side (K) : &d",T1);
printf("Thickness of conductor (m) : &d",X);
K=((H*X)/A)*(T2-T1);
printf("Coefficient of thermal conductivity : &d",K);
printf("Coefficient of thermal conductivity (W/m-K) : &d",K);
}
void calcA()
{
printf("Temperature on one side (K) : &d",T2);
printf("Temperature on other side (K) : &d",T1);
printf("Thickness of conductor (m) : &d",X);
A=(H*X)/K*(T2-T1);
printf("Cross-sectional area of conductor : &d",H);
printf("Coefficient of thermal conductivity (W/m-K) : &d",K);
printf("Cross-sectional area of conductor (m^2) : &d",A);
}
void calcX()
{
printf("Temperature on one side (K) : &d",T2);
printf("Temperature on other side (K) : &d",T1);
X=K*A*(T2-T1)/H;
printf("Thickness of conductor : &d",H);
printf("Coefficient of thermal conductivity (W/m-K) : &d",K);
printf("Cross-sectional area of conductor (m^2) : &d",A);
}
void calcT1()
{
printf("Temperature on one side (K) : &d",T2);
printf("Thickness of conductor (m) : &d",X);
T1=-(H*X/K*A-T2);
printf("Temperature on other side : &d",H);
printf("Coefficient of thermal conductivity (W/m-K) : &d",K);
printf("Cross-sectional area of conductor (m^2) : &d",A);
}
void calcT2()\
{
printf("Temperature on one side (K) : &d",T2);
printf("Thickness of conductor (m) : &d",X);
T2=H*X/K*A+T1;
}
printf("Temperature on one side : &d",ch);
switch(ch) //calling the respective fucntion
{
case 1: calcH();
break;
case 2: calcK();
break;
case 3: calcA();
break;
case 4: calcT2();
break;
case 5: calcT1();
break;
case 6: calcX();
break;
default: printf("Invalid Choice");
break;
}
return 0;
}

Add a comment
Know the answer?
Add Answer to:
Can someone convert this to C programming language? #include using namespace std; class phyfor { public:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT