The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
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";
}
}
ENGR 2304Programming for EngineersC++ Program AssignmentThe 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 workedin class to determine the reaction forces (Ax, Ay, and Cy) and complete the analysis by the Method ofJoints.When you have finished the program, you will upload the .cpp file to D2L in the AssessmentDropbox folder named C++ Program.Check with me before you leave to make sure I have received yourfile.Program Requirements1.Use CodeBlocks to build and run your program.Name your program: Lastname_Truss.cpp2.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 F1and F2.4.You must create and use a function to calculate the hypotenuse of the right triangle you willneed to help determine x and y force components of the truss members.5.You must create and use a function to evaluate whether a force in Tension or Compression.Thefunction will be called multiple times, once for each member.Any force value that has amagnitude from -0.00001 < F < 0.00001 will be considered a Zero Force member.6.You must store each Force member name as a constant character string.For example, FADwillbe stored as “Fad” for the string.You will use these character strings when you display youroutput.7.Your output must be clearly stated to the user.For example, if FAD= -200, then your outputshould read something like:Fad has a magnitude of 200 and is in Compression.If FBC= 150, then it will be:Fbc has a magnitude of 150 and is in Tension.xABCDEF1hF2
Attachments:
-----------