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

  How to make components of system user-friendly

How do components of your computer system interact within system? What improvements or additions to your system do you think would benefit you or make system more user-friendly? Why?

  Determine minimum number of tapes needed for backups

Days of the week (including the weekend), determine the minimum number of tapes needed to accommodate seven days worth of backups?

  Write files which do not reside at root or master directory

Provide the example of names of three files from own computer that do not reside at the root or master directory. For each file, list both therelative filename and its complete filename.

  Benefits of binary file called registry

Write down the benefits and disadvantages of configuration in binary file called registry.

  Government imposes below-equilibrium price ceiling on market

If the government imposes the same below-equilibrium price ceiling on all these markets, which of the following statements will be true?

  Evaluation process to seven-step acquisition model

Discuss in scholarly detail the acquisition evaluation process to the Seven-Step Acquisition Model.

  Objectives of ibm behind

While Jeopardy is a fun game, and while explicit goal is to build a program to beat a human champion at game, the real goal for building Watson is different and multi fold.

  Explaining visible and consistent management support

Illustrate visible and consistent management support. Establish privacy responsibilities. Privacy needs need to be incorporated into any position which handles personally identifiable information (PII).

  Access control system

What access control system is most valuable for protecting enterprise systems? Why? What are two specific strengths and two specific drawbacks for your chosen access control system?

  When merge sorting you could recursively

Suppose when merge sorting you could recursively sort four sub-lists instead of two and still merge them all in linear time. Give the recurrence relation that describes this.

  Compute minimum-maximum possible values for distance

During run, compute the minimum and maximum possible values for the following distance measures (from the center of the track): Manhattan, Euclidean and Chebyshev distance.

  Uml state diagram situations in chess game

You are required to draw a UML state diagram to represent the following situations in Chess game.

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