Search Text File Flowchart Example
In this tutorial, we will search a text file using Flowgorithm. This flowchart example will show the usage of the new File I/O flowchart symbols in action.
File I/O Symbols are:
The flowchart will prompt the user to enter a student name. It will search for the name in the file and let the user know if the student’s name is present in the input file.
Create a text file
The input text file to the flowchart contains the names of students. Create a text file called names.txt. Let’s assume that each student’s name is in a single line.
Design the flowchart
Let’s design the flowchart to search the text file.
Open the File
Open the input file in the Read mode using the Open file symbol.
Declare the variables.
String variables line and searchName. The line contains the student’s name in each line
Boolean variable isFound initially set to False. We will set this flag to True when there is a match.
Prompt the user to enter the search name. The user will enter that name to be searched in the file.
Add Loop and Read File
Add a loop and in the loop read the line using the Read file symbol. We will match it with the search name. If they both matches set the found flag to True and display that the name is in the file.
Close the File
If not isFound then print the message that the name is not found. Close the file handle using the Close file symbol.
Save and Run the flowchart with a test case. Search for a student name to view the output.
Flowgorithm flowchart tutorials on this website:
For more information on the Flowgorithm tool, please visit the official website at: