473,805 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Desperate !! Stuck on a simple C task...

4 New Member
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_incremen ts /*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:

#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_bea m);
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
Nov 19 '06 #1
5 1632
horace1
1,510 Recognized Expert Top Contributor
implement the program in sections, e.g. start by
Expand|Select|Wrap|Line Numbers
  1. Read minimum moment
  2. Read maximum moment
  3. read  number of incremenets
  4. moment=minimum moment
  5. increment =  
  6. while (moment < = maximum moment)
  7.     use existing code to calculate the min and max stress
  8.     moment = moment + increment
  9.  
when that is working put the results in a linked list - do you have to write you own or can you use the STL, e.g.
http://www.cppreferenc e.com/cpplist/index.html
Nov 19 '06 #2
yojimbo2005
4 New Member
You can write your own. Im not sure i understand your porgram, what exactly do u mean in sections. i really dont understand this. I have tried doing it step by step, but to no avail...
Nov 20 '06 #3
yojimbo2005
4 New Member
Hi, cheers taking time to help me out.

i need to make a linked list that stores all the values of stress, calculated for each value of applied moment, incorporating the number of increments...

so lets say minimum stress works out to be 100 Nm and max is 500 Nm and your number of increments is 5 then you'd need to store values for 100, 200, 300, 400, and 500 Nm

so, im going to have to define number_incremen ts, as well as the others on my first program, any suggestions
Nov 20 '06 #4
Kudzanayi
1 New Member
I want the basics on how to start my own c programme
Nov 21 '06 #5
yojimbo2005
4 New Member
hey guys, really apreciate the help been brought forward and all but im still finding it difficult to take on board the advice given, would it be possible to make an example program of how you would tackle the question so i can see whats been done and how it works or if not just code the loop and the linked list and then word the basics, cheers in advance
Nov 21 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1408
by: ahevans | last post by:
HI, I have the following scenario if (isset($area)) { if ($area === 'green') { if (isset($task)) {
9
3551
by: DD | last post by:
Hello, Could anyone please help me?? Is there somebody who could explain me how to make a connection to a access database with a python cgi script. I would like to use common sql commands in my python scripts as I can with MySQLdb. But I cannot even connect to the access database (see below). Could anyone explain it to me as simple as possible please. I'm using Windows XP, ActivePython 2.3.2 build 230 and Microsoft access(XP?)
5
1794
by: Tank | last post by:
I have had this post up here when i was trying to figure out how to make leading zeros and have been able to fudge that to work. I am now have trouble getting the loop that makes the folders to start fresh after the .jpg section of the move images code. this will be essential to make the whole thing work. Please help. Even if you just write out the solution. I am beggin. I am desperate. Please help. <!DOCTYPE HTML PUBLIC...
5
2198
by: John Flynn | last post by:
hi all i'm going to be quick i have an assignment due which i have no idea how to do. i work full time so i dont have the time to learn it and its due date has crept up on me .. As follows: Objectives The purpose of this assignment is to have you practice the design of object-oriented classes, including one or more of the following concepts
26
1967
by: _R | last post by:
Given that VS2005 has made an effort to clean up the syntax of VC++ (in C++/CLI), is there any future plans to do away with function protos, ala C#/VB? What are they needed for these days?
4
1175
by: Aaron Smith | last post by:
I post a message about this, but noone responded.. Well, I've played around as much as I can and I'm completely stuck and out of ideas. This should be a really simple task, but it seems that it is beyond me why this has to be so hard to do. I have two tables, the ID is an Autonumber in Table 1. Table two is the child to the previous table. Table 2 is in a grid. I enter information in table 1, then I go to the grid and enter a row...
0
2265
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional assistance. I say additional because I've already had help which is greatly appreciated. I do try to take the time and understand the provided script in hopes on not having to trouble others on those. But here it goes...
16
1620
by: Herb | last post by:
I am new to vb.net coming from vb6 I built and published an app that work fine on the production machine. I try installing it on a clean machine and I installed NETFramework2.0.50727 ( i am using Vb.net 2005 no sp1 and these are the references of the compiled program). I check that these references are identical on both machines and in the proper location and they were The installed went fine but when I run the program I see it...
2
2002
by: netchicken | last post by:
Hi there, I am flumoxed with this error that has been plaguing me. I have loaded up script.aculo.us and prototype, and tried to tet them to run, just simple stuff, to slide down and fade extra information with the core of it bolded... <h2 class="ajax_h2" style="cursor: pointer" onclick="showIt(Effect.Appear('latest-posts'))">More latest posts- click for more</h2>
0
1228
by: yjh0914 | last post by:
hi guys! so im basically editting my post i made earlier as it wznt as specific.. i have to make a program that basically ranks students by their cumulative gpa. the student's info is on a csv file written in a format like this, "name,bday,sex,9-1,9-2,10-1,10-2.....,cumulative". my question is, should i read this whole line nd jz use the cumulative data (im not sure how to do dat:/) or make a separate class nd make an array (for loop nd stuff)...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5541
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.