Write a main function, and the following functions

Assignment Help Basic Computer Science
Reference no: EM13166224

Write a main function, and the following functions to compute the stress and strain oa a steel rod(D) (in inches) and length(L) in inches subject to the compression load(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^6.
function to compute the stress formula:
stress f = P/A

where A =?D2/4.0

A function to compute the strain from the formulas:

elongated or shortened length:

? L = fL/E

strain e = ? l/l = f/E

A function to output the stress and strain at different loads of P.

I have everything working right except the elongated or shortened length isn't taken into account.

#include <stdio.h>
#include <math.h>
#include<conio.h>

// computes stress of a steel rod takes load & diameter as parameters

double stress(long load, double d)

{

double A;

A= (3.14*d*d) /4.0;

return

load/A;

}

//computed strain of a steel road takes load & diameter as parameters

double   strain(long load,double d)

{

double f;

//calls stress funtion

f=stress(load,d);

//calculates f/E and returns as strain where E=30*10^6.

return

f/(30*pow(10.0,6));

}

//displays calculated stress & strain at each load.

void    output(long p,double stra,double stre)

{

printf("%6ld\t%0.4lf\t%.3lf\n",p,stra,stre);

}

int main()

{

double   d,strin,stres;  

//diameter,strain,stress

long   p;  

//load

//gets diameter of steel rod from user

printf("Enter diameter D of steel rod: ");

scanf("%lf",&d);

//computes stress and strain of steel rod at each load through 10000 to 1000000 increments of 100000

printf("\nLoad\tstrain\tstress\n\n");

for

(p=10000;p<=1000000;p=p+100000)

{

strin=strain(p,d);

stres=stress(p,d);

output(p,strin,stres);

}

printf("\n");
getch();
}

Reference no: EM13166224

Questions Cloud

Calculate the de broglie wavelength of an neutron : Calculate the de Broglie wavelength of an neutron moving at 1% the speed of light. Calculate the velocity of a neutron with a wavelength of 75pm.
State treatment with chloroform : A solid Silver Group (Anion) unknowon that contains only sodium ion as a catio is acidified and divided into tow portions, to both of which 6 M HC2H3O2
Design competition : Explain why you think Gustave Eiffel’s design was the one chosen from over 700 submissions to a design competition.
State the ph values of water and blood : * State what the patient can include and avoid in her diet on a regular basis to avoid these symptoms in the future.
Write a main function, and the following functions : Write a main function, and the following functions to compute the stress and strain oa a steel rod(D) (in inches) and length(L) in inches subject to the compression load(P) of 10,000 to 1,000,000 pounds
State a colored compound or complex ion : A colored compound or complex ion provides a preliminary indication of the presence of which of the aluminum Group ions? Give the chemical formula
Describe a contemporary monument : Describe a contemporary monument in your city or in another U.S. city and whether it holds some special significance for the citizens of the city where it was erected. State whether you like or dislike the monument and explain why.
What is internal audits role in the organizations ethics : What is internal audits role in the organization's ethics and compliance program and what is the board's role in the organization's ethics and compliance program?
What will be the mass of the probe on the surface of mars : If a space probe weights 39,200 N on the surface of earth, what will be the mass of the probe on the surface of mars.

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Whether each of these proposed

Determine whether each of these proposed definitions is a valid recursive definition of a function f from the set of nonnegative integers to the set of integers. if f is not well defined state reason; If f is well defined, find a formula for f(n) ..

  Goals of system monitoring urban weather and pollution

What goals would you have for the system besides monitoring urban weather and pollution? What legal and ethical concerns should you understand prior to deploying the network?

  Expalin programs like ping and some of scanning tools

When using programs such as ping and some of the scanning tools to do forensic investigations, we may easily tip off the suspect that is under investigation

  Describe why suggestion of connecting by twisted pair cable

Describe why you would suggest connecting all current and new client computers using twisted pair cable instead of staying with the current coax wiring structure.

  Explaining final results in cell to a percentage

Second quarter revenue total has increased from first quarter revenue total by 60.16%. Make sure to change cell format for final results in the cell to a percentage.

  Compute price-output if firm-oligopolstic industry collude

If firms in an oligopolstic industry successfully collude and form a cartel, what price and output will result? Price lower than the competitive price and because there are only a few firms in the industry, less output than the competitive amount

  How "direction" can be used in an effective publication?

What are four examples of how "direction" can be used in an effective publication?

  Encode or decode a color combination

In the early days of computer graphics, colors where represented as two numbers. The first number was the foreground color and the second was the background color. These two values, which ranged from 0 to 15 were stored within a single byte; the fore..

  Decreasing risk of malicious attacks in personal systems

Security budgets is devoted to decreasing risk of malicious attacks. What threats are you aware of when it comes to the personal systems and systems at job

  Explain what occurs if instruction going through pipeline-lb

Consider processor with six stages: IF(instruction fetch), DA(instruction decode), CO(calculate operands addresses), FO(fetch operands), EX(instruction execution), WB(write results). Explain briefly what occurs in each stage when instruction going ..

  Explaining records are stored and accessed on storage medium

Which of the given correctly explains a way in which data records are stored and accessed on storage medium?

  Hierarchy chart and then plan the logic

Draw the hierarchy chart and then plan the logic for a program needed by the sales manager of The Henry Used Car Dealership. The program will determine the profit on any car sold

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd