Thread: For Loop Problems

  1. #1
    Registered User
    Join Date
    Mar 2010

    For Loop Problems

    I am creating a program that calculates the beam sized needed for a certain load based on three given equation. I need to automate the selection of beam width. Which means I have to run the functions until they pass the test. I am incrementing the width by 2.(2x2 4x4....) I want my For loop to run until the if test is true and the variable test=1 and print out the statement. Right Now it seems like I can't even enter the for loop, I am only prompted for the length and load then nothing happens. I can't seem to figure out why, any suggestions would be great. I attached the source file.

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Liverpool UK


    {    loadb=buck(length,width);
        if(loadb<=load && loadc<=load && result==1)
        {cout<<"For a load of "<<load<<" and a length of "<<length<<" inches,recommended sqaure beam has a side of "<<width<<" inches\n";
    it should be ==
    but i dont like it anyhow, why dont you use a while loop instead?


  3. #3
    Registered User
    Join Date
    Mar 2010
    I didn't like it much either, used a while loop instead, much easier. Thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 05:48 PM
  3. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  4. contest problems on my site
    By DavidP in forum Contests Board
    Replies: 4
    Last Post: 01-10-2004, 09:19 PM
  5. DJGPP problems
    By stormswift in forum C Programming
    Replies: 2
    Last Post: 02-26-2002, 04:35 PM