Write a main function and the following functions to compute the stress and stra
ID: 3623674 • Letter: W
Question
Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) and length L (inches) subject to the compression loads P of 10,000 to 1,000,000 pounds in increments of 100,000 pounds. The modulus of elasticity E for steel is 30 X 10 to the 6th power.
A function to compute the stress from the formulas stress f = P/A
where A = pie D to the second / 4.0
A function to compute the strain from the formulas
elongated or shortened length AL = fL/E
strain e = AL/L = f/E
A function to output the stress and strain at different loads of P
Explanation / Answer
#include<stdio.h>
double GetStress(int p,double d)
{
double A=(3.14*diameter*diameter)/4;
double s;
s=p/A;
return s;
}
double GetStrain(double str)
{
double sta;
sta=str/(30*math.pow(10,6));
}
void main()
{
double diameter,stress,A;
printf("Enter Diameter:");
scanf("%d",&diameter);
for(p=10000;p<=1000000;p=p+100000)
{
stress=GetStress(p,A);
printf("Stress at Loads:%f%f",p,stress);
strain=GetStarin(stress);
printf("Strain:%f",strain);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.