Write a program to compute the diameter in centimeters of a steel, aluminum, and
ID: 3629428 • Letter: W
Question
Write a program to compute the diameter in centimeters of a steel, aluminum, and copper rod, which can withstand a particular compression load. The allowable compression stress of steel is 25,000 lbs/m2 , 15000 lbs/m2 for aluminum, and 20,000 lbs m2 for copper.area of rod = compress load/ allowable compression stress
area = pr2 where diameter d = 2r
Input the compression load. Print the type of material. load, allowable stress, and diameter. Use format output with field with specifications that align the output.
Explanation / Answer
//Varible declaration.
double load,area,dia,radius;
//Getting input.
cout<<"Enter diameter of three rods:"<<endl;
cin>>load;
//calculation for diameter for Steel Rod.
area=load/25000;
radius=sqrt(area/PI);
dia=radius*2;
//calculation for diameter for alum Rod.
area=load/15000;
radius=sqrt(area/PI);
dia=radius*2;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.