In your computer science class, you may be required to draw a flowchart to represent the flow of logic for your assigned program. Usually, a program begins with either a flowchart or an algorithm (or both) to aid in the design phase of writing a program. Making a flowchart for a program that uses an array to hold data is really no different from any other flowchart. All data is represented using the same flowchart symbol.
Draw a flowchart as you would for any data type, single variables or arrays. Generally, you will start with an input box---a parallelogram. Inside this, indicate the type of data to be stored in the array. You might draw the array inside the parallelogram as it is typically drawn, as a long box divided up into many smaller boxes for data.
Optionally, illustrate the looping procedure to read in the data on the flowchart. Do this with a decision box, the diamond, which uses two connector arrows. One arrow is for the action when the decision test passes and the other for when the decision test fails. Place the diamond above the input box (the parallelogram). The decision is simple: if the array is not full, read in an element and add one to the array index counter. Do this by drawing the test passes connector arrow to the input box. From the input box, the exiting connector arrow goes back up to the decision diamond, creating a loop. Back at the decision diamond, if the array is full, meaning the decision test fails, the second connector arrow proceeds to the rest of the flowchart, skipping over the input box.
Use standard rectangular boxes for all operations and processes done on the array. Again, as most procedures will be repeated with a looping nature, you can illustrate this the same as you did for reading in the array, by using a decision diamond and constructing a loop with the connecting arrows.
Follow all usual steps for your flowchart as you would with single variables. End your flowchart with a circle, denoting the end of the program.
- Comstock/Comstock/Getty Images