Thread: flowchart. Help!!!

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    10

    Question flowchart. Help!!!

    Anyone know how to write a flowchart for this code? I'm stuck here.

    min_number=var_array[0];

    for(i=0 ; i<6 ; i++)
    {
    if (var_array[i] < min_number) min_number=var_array[i];
    }

    printf("\n\n\n\n\n\n\n\n\n\n\n");
    printf(" The minimum value is %d \n", min_number);


    Thanks in advance...

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    I assume you have problems making the flowchart for the for-loop. I'll do it in text, you can draw the chart yourself.

    Code:
    initialisation -> check == TRUE -> loop-body -> increase counter -> (now back to the check)
                       -> check == FALSE -> end of loop

  3. #3
    Visionary Philosopher Sayeh's Avatar
    Join Date
    Aug 2002
    Posts
    212
    Code:
    min_number=var_array[0];
    
    for(i=0 ; i<6 ; i++) 
       {
       if (var_array[i] < min_number)
          min_number=var_array[i]; 
       };
    
    printf("\n\n\n\n\n\n\n\n\n\n\n"); 
    printf(" The minimum value is %d \n", min_number);
    FLOWCHART
    ----------------
    see attached gif.

    WHAT IT DOES
    -------------------
    this code simply finds the smallest number in the list of 6 entries and outputs it at the end. It's missing a couple of things.
    It is not the spoon that bends, it is you who bends around the spoon.

  4. #4
    ~- Y u n a -~ beely's Avatar
    Join Date
    Dec 2001
    Posts
    291
    i would think that the for-loop statement should be in a way, right, how about this example ? hopefully this kind of graphic look beautiful anyway.

    Code:
    at the for-loop section,
    
                        |
                        |
                        |
                        |
                     i = 0;
                        |< --------------------------------------------------
                        |                                                                 |
                     i < 6?                                                            |                
                        |                                                                  |
                        |-------- <accordingly to the "yes" way >---|
                   no |
                        |
                        |
                     printf ....
                       | 
                       |
                       |
                       end
    :: HOPE fully this graphic is good.


    tagged by Salem
    PS - change the tabs to spaces, then edit your post

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Flowchart Software?
    By Cell in forum Tech Board
    Replies: 2
    Last Post: 02-09-2009, 08:20 AM
  2. Flowchart Question
    By dmkanz07 in forum C Programming
    Replies: 1
    Last Post: 04-08-2007, 11:33 AM
  3. Flowchart question: Classes
    By darnok in forum C++ Programming
    Replies: 6
    Last Post: 06-17-2004, 06:25 PM
  4. Flowchart Program
    By jdm71488 in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-24-2004, 01:48 PM
  5. Flowchart
    By ob1cnobe in forum C++ Programming
    Replies: 4
    Last Post: 06-05-2002, 12:03 PM