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

  What is a knowledge repository?

What is a knowledge repository? What is a community of practice? What is a chief knowledge office? What are his or her duties? What is natural language processing? What are the three (3) levels of voice recognition? What is a learning system?

  Identify a recent moral dilemma or ethically questionable

Identify a recent moral dilemma or ethically questionable situation relating to ICT - use the Doing Ethics Technique (DET), ensuring you address each of the DET questions;

  Internet, internet, intranet

Define the terms internet, Internet, intranet and extranet, highlighting the similarities and differences between them.

  Finding counterexample-algorithm based on greedy strategy

Determine a counterexample for following algorithm based on greedy strategy.

  Information assets to estimate for risk management purposes

If the organization has three information assets to estimate for risk management purposes which vulnerability must be estimated for additional controls first? Which vulnerability must be evaluated last?

  Explaining leverage data from across enterprise

Many companies have executed ____________ to enable managers and knowledge workers to leverage data from across enterprise.

  Given a 3 millisecond seek time

Given a 3 millisecond seek time for a disk drive and assuming that once you reach the starting track you will write the file as contiguous sectors, how long will it take to write a 1 megabyte file? The disk rotates at 7200 rpm and each sector hold 1 ..

  The recommended entry strategy into international markets

An expert system is used to determine whether the recommended entry strategy into international markets should be Investment (I), Contractual (C), or Export (E).

  Distinguish online learning with classroom learning

Write the exploratory essay in which you distinguish online learning with classroom (on-ground) learning. Your estimation may incorporate preparation time.

  Compare and contrast the in terms of cores/microprocessors

Compare and contrast the following, in terms of cores (or microprocessors), random access memory (RAM), disk storage, and networking capabilities.

  Event drive programming

Lets look at event drive programming. What is an event driven program? What are events associated with? What are examples of common events?

  Wish to represent an n-vertex graph

Suppose we wish to represent an n-vertex graph G using the edge list structure, assuming we identify the vertices with the integers in the set {0,1,...,n?1}.

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