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);

C++ Program Assignment The purpose of this program is to identify the forces of each member of the truss below (FAB, FAD, Fec, FBD, FRE, F 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 to D2L in the Assessment Dropbox folder named C++ Program. Check with me before you leave to make sure have received your file. D Program Requirements 1. Use CodeBlocks to build and run your program. Name your program: Lastname Truss.cpp 2. Your code should be properly commented to describe what you are doing. 3. The user should be prompted to enter pitch width, x, height, h, and the applied forces F1 and F2 4. You must create and use a function to calculate the hypotenuse of the right triangle you will need to help determinexand y force components of the truss members. 5. You must create and use a function to evaluate whether a force in Tension or Compression. The function will be called multiple times, once for each member. Any force value that has a magnitude from -0.00001 KF 0.00001 will be considered a Zero Force member. 6. You must store each Force member name as a constant character string. For example, FAD will be stored as \"Fad\" for the string. You will use these character strings when you display your output. 7. Your output must be clearly stated to the user. For example, if F 200, then your output AD should read something like Fad has a magnitude of 200 and is in Compression. 150, then it will be: Ebc has a magnitude of 150 and is in Tension.

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;
}

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
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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site