Desperate !! Stuck on a simple C task...
--------------------------------------------------------------------------------
hey all, as part of my computing module i have been asked to create a program that will promp the user for the following:
depth_beam /* i.e fprintf etc "enter value of beam" then fscanf %lf depth_beam*/
breadth_beam
min_moment
max_moment
number_increments /*between minimum and maximum moments*/
then calculate bending stress using a loop controlled by relevant input data ^ and should store values of moment maximum and minimum stress in a linked list.
after completing calculations it is to write the values from the linked list to the screen as a table:
depth of beam:
breadth of beam:
minimum applied moment:
maximum applied moment
number of increments.
as a guide iv included the program that i used on the previous question which was to calculate max and min tensile stresses:
Code:
#include <stdio.h>
int main(void)
{
double tensile_min;
double tensile_max;
double bending_moment;
double moment_area;
double depth_beam;
double breadth_beam;
fprintf(stdout, "Enter the magnitude of the Applied Bending Moment (Nm):");
fscanf(stdin, "%lf", &bending_moment);
fprintf(stdout, "Enter the Breadth of the beam (m):");
fscanf(stdin, "%lf", &breadth_beam);
fprintf(stdout, "Enter the Depth of the beam (m):");
fscanf(stdin, "%lf", &depth_beam);
moment_area = (breadth_beam * depth_beam * depth_beam * depth_beam) / 12;
tensile_min = ((0-bending_moment) * depth_beam) / (moment_area*2);
tensile_max = (bending_moment * depth_beam) / (moment_area * 2);
fprintf(stdout,"\n\nThe Second Moment of Area for this particular beam is: %.2lf m4\n", moment_area);
fprintf(stdout,"With a Minimun Tensile Stress of %.3lf N/m2\n", tensile_min);
fprintf(stdout,"And a Maximum Tensile Stress of %.3lf N/m2\n", tensile_max);
return(0);
}
cheers in advance, any help would be greatly apreciated, i have got a really unhelpful tutor who wont explain beyond his set of notes (which are extremely poor and unthought-out
James