Program must show individual outputs for each variable FAB F
Program must show individual outputs for each variable (FAB, FAD, FBC, FBD, FBE, FCE, FDE)
Equations used in this program:
Cy=(((1/4)*F1)+((3/4)*F2));
Ay=(((3/4)*F1)+((1/4)*F2));
z=sqrt(((1/4)*x*x)+h*h);
Fad=(-(z/h)*Ay);
Fab=((-x/(2*z))*Fad);
Fbd=(-Fad-(z/h)*F1);
Fde=((x/(2*z))*(Fad-Fbd));
Fbe=(-Fbd);
Fbc=Fab+(x/(2*z))*(Fbd-Fbe);
Fce=(-(z/h)*Cy);
Solution
#include<iostream.h>
#include<math.h>
#include<conio.h>
int main(){
float x,h,y,f1,f2,cy,ay,z,fad,fbe,fab,fbd,fde,fbc,fce;
//function calc_hypo declaration.
float calc_hypo(int x,float y);
//function evalForce declaration.
char* evalForce(float f);
clrscr();
//reading the x value
cout<<\"\ Enter x value:\";
cin>>x;
//reading the y value.
cout<<\"\ Enter y value:\";
cin>>y;
//reading the force f1 value.
cout<<\"enter Force(F1) Value:\";
cin>>f1;
//reading the force f2 value.
cout<<\"enter Force(F2) Value:\";
cin>>f2;
//calculating the hyponent by calling calc_hypo function
h=calc_hypo(x,y);
//calculanting the values for fab,fad,fbd,fde,fbc,fce.
cy=(((1/4)*f1)+((3/4)*f2));
ay=(((3/4)*f1)+((1/4)*f2));
z=sqrt(((1/4)*x*x)+h*h);
fad=(-(z/h)*ay);
fab=((-x/(2*z))*fad);
fbd=(-fad-(z/h)*f1);
fde=((x/(2*z))*(fad-fbd));
fbe=(-fbd);
fbc=fab+(x/(2*z))*(fbd-fbe);
fce=(-(z/h)*cy);
cout<<\"\ FAD has a magnitude of \"<<fad<<\"in \"<<evalForce(fad);
cout<<\"\ FAB has a magnitude of \"<<fab<<\"in \"<<evalForce(fab);
cout<<\"\ FDE has a magnitude of \"<<fde<<\"in \"<<evalForce(fde);
cout<<\"\ FBE has a magnitude of \"<<fbe<<\"in \"<<evalForce(fbe);
cout<<\"\ FBC has a magnitude of \"<<fbc<<\"in \"<<evalForce(fbc);
cout<<\"\ FCE has a magnitude of \"<<fce<<\"in \"<<evalForce(fce);
return 0;
};
//calculating the hyponent member
float calc_hypo(int x,float y){
float h=0.0f;
h=sqrt((x*x)+(y*y));
return h;
}
//evalvating the force either in tension or compressions
char* evalForce(float f){
char s[]=\"\";
if(f>-0.00001 && f<0.00001) *s=\"Zero Force member\";
else if(f>0) *s=\"Tension\";
else if(f<0) *s=\"Compression\";
return &s;
}

