Thread: flowchart with if else statements

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    1

    flowchart with if else statements

    Hey guys,

    I am trying to create a flow chart and I am sort of stuck on something that should be simple.

    i am trying to make a flowchart of if else statement which goes like this:

    if x>5,size=big
    else if x<5, size=small
    i am new to programing and i need some help with zis

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Code:
    size = small;
    if(size >5) 
        size = big;
    ?

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The if should go into a diamond. If I remember correctly the right side is yes (positive result) and the left side is no (negative result) (or you can specify which side is yes/no).

    x > 5 goes in the diamond, Size = big would go into a rectangle on the yes side and the other would have size = small. No need for the else if since else will do the same here. However you have no condition for x == 5.

    I find sequence diagrams far more helpful than flowcharts and they are easier to follow.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Skipping If Statements?
    By CBecker5000 in forum C Programming
    Replies: 1
    Last Post: 11-08-2009, 04:05 PM
  2. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 04:09 AM
  3. newbie question - if statements without conditions
    By c_h in forum C++ Programming
    Replies: 2
    Last Post: 07-18-2008, 10:42 AM
  4. Efficiency of case statements
    By Yasir_Malik in forum C Programming
    Replies: 26
    Last Post: 05-23-2006, 11:36 AM
  5. Need help with "if" statements
    By Harryt123 in forum C Programming
    Replies: 22
    Last Post: 05-14-2006, 08:18 AM