The purpose of this program is to identify the forces of eac
The purpose of this program is to identify the forces of each member of the truss below (FAB, FAD, FBC, FBD, FBE, FCE, FDE) and to state whether they are in tension or compression.Use the example we worked in class to determine the reaction forces (Ax, Ay, and Cy) and complete the analysis by the Method of Joints.When you have finished the program, you will upload the .cpp file.
Here is what I have but I can\'t run it.
#include<iostream.h>
 #include<math.h>
 #include<conio.h>
 void main()
 {
 float x,y, F1,F2,Cy,Ay,Z,Fad,Fab,Fbd,Fde,Fbe,Fbc,Fce;
 //prompt the user to enter pitch width x,height h and applied forces F1,F2
 cout<<\"Enter pitch width x height h, and the applied forces F1,F2\";
    cin>>x>>y>>F1>>F2;
 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/(2z))*Fad);
 Fbd=(-Fad-(z/h)*F1);
 Fde=(x/2z*(Fad-Fbd));
 Fbe=(-Fbd);
 Fbc=Fab+(x/2z)*(Fbd-Fbe);
 Fce=(-(z/h)*Cy);
 if((Fad||Fab||Fbd||Fde||Fbe||Fbc||Fce)<0)
 {
 cout<<\"Zero force member\";
 }
 else if((Fad||Fab||Fbd||Fde||Fbe||Fbc||Fce)>=200)
 {
 cout<<\" magnitude is compression\";
 }
 else if((Fad||Fab||Fbd||Fde||Fbe||Fbc||Fce)<=150)
 {
 cout<<\"magnitute is tension\";
Solution
Corrected all the errors from your program.
Its running fine now.
program and output are as follow.
**********************************************program********************************
#include<iostream>
 #include<cmath>
 using namespace std;
 int main()
 {
 float x,y, F1,F2,Cy,Ay,Z,Fad,Fab,Fbd,Fde,Fbe,Fbc,Fce;
 float z; // z variable
 float h; //height variable
 //prompt the user to enter pitch width x,height h and applied forces F1,F2
 cout<<\"Enter pitch width x height h, and the applied forces F1,F2:\"<<endl;
 cin>>x>>h>>F1>>F2;
 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);
 if((Fad||Fab||Fbd||Fde||Fbe||Fbc||Fce)<0)
 {
 cout<<\"Zero force member\";
 }
 else if((Fad||Fab||Fbd||Fde||Fbe||Fbc||Fce)>=200)
 {
 cout<<\" magnitude is compression\";
 }
 else if((Fad||Fab||Fbd||Fde||Fbe||Fbc||Fce)<=150)
 {
 cout<<\"magnitute is tension\";
 }
 }
***********************************output***************************************
Enter pitch width x height h, and the applied forces F1,F2:
8
15
 60
 90
 magnitute is tension
 --------------------------------
 Process exited with return value 0
 Press any key to continue . . .


