Grantham 263 question 2 page 335 Write a main function and the following functio
ID: 3639665 • Letter: G
Question
Grantham 263 question 2 page 335Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) length L(inches) subject to the compression loads P of 10,000 to 1,000,000 pound in increments of 100,000 pounds. The modulus of elasticity E for steel is 30 X 106
A function to compute the stress from the formulas
stress f = P/A
where A= ? D2/4.0
A function to compute the strain from the formulas
elongated or shortened length (change)L = fL/E
strain e = (change)L/L = f/E
Explanation / Answer
#include<stdio.h> #include <math.h> float compute_stress(); float compute_strain(); float output_results(); int main( ) { float compute_stress (float stress, int p); float compute_strain (float strain); void output_results(float stress, float strain, int p); return 0; } float compute_stress() { const float PI = 3.141593; float stress, diam , area; printf("Enter diameter: "); scanf_s("%d", &diam); area=(PI * (diam *diam ))/4; { int p; for(p=10000; p<=100000000; p= p+100000) { stress = p/area; return stress; } } } float compute_strain(float stress) { const float e=30000000; float strain; strain = stress/e; return strain; } void output_results (int p, float stress, float strain) { printf("Compression Load = %f lbs. Stress = %f Strain = %f", p, stress, strain); return; } Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.