Populate Array with User Input in Flowchart
Overview
In the earlier tutorial, we learned about Array in flowcharts. However, we have hardcoded the array elements. This tutorial will teach us to populate an array with user input. The contents in the array would be dynamic.
Flowgorithm Flowchart
The ‘fruits’ is the array variable. The array holds fruit names i.e String data type. The array size is 5.
The ‘index’ is the Array index variable. The legal values of the array index variable in this example are from 0 to 4.
Loops
The flowchart uses two ‘for loops’. The first loop is to populate the array contents from the user and the second loop to output the contents of the array to the console window. A for loop is used because we know the array size beforehand and how many times to iterate the loop.
For loop in Flowgorithm
https://www.testingdocs.com/for-loop-statement-in-flowgorithm/
Sample Output
Execute the flowchart. Click on the Green run command to execute the flowchart.
The flowchart prompts the user to enter 5 fruit names. The names are stored in the fruits array.
Bad Subscript Error
The below sample error is when we attempt to store or access array element that is not within the valid range:
—
Flowgorithm Tutorials
https://www.testingdocs.com/flowgorithm-flowchart-tutorial/
Flowgorithm Website: