0% found this document useful (0 votes)
3 views

Algorithm for main module

The document outlines algorithms for a main module and various operations on student records, including adding, deleting, searching, and updating records. Each algorithm consists of a series of steps detailing how to manipulate a data file named 'STD.DAT'. The main module also includes a menu for user interaction with options for managing student records.

Uploaded by

kg8156651
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Algorithm for main module

The document outlines algorithms for a main module and various operations on student records, including adding, deleting, searching, and updating records. Each algorithm consists of a series of steps detailing how to manipulate a data file named 'STD.DAT'. The main module also includes a menu for user interaction with options for managing student records.

Uploaded by

kg8156651
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Algorithm for main module

Step 1: start
Step 2 : declare required procedure
Step 3: call sub procedure in mainmodule
Step 4: display menu as following
1. Add new record
2. Delete record
3. Search record
4. Delete record
5. Update record
6. Exit
Step 5: stop
Algorithm for adding record
Step 1: start
Step 2: open datafile “STD.DAT” in APPEND mode
Step 3: get ID, N$, C, A$, T# OF Student.
Step 4: store all data in datafile
Step 5: does the user want to add more record?
{Y: go to step 3}
Step 6: stop
Algorithm for deleting record
Step 1: start
Step 2: open datafile “STD.DAT” in input mode and a new datafile “TEMP.DAT” in output mode
Step 3: get DR
Step 4: read ID, N$, C, A$, T# OF Student.
Step 5: is ID equal to DR?
{No: store record in data file “TEMP.DAT}
Step 6: Are all records read from file “STD.DAT”?
{No: Go to step 4}
Step 7: close both files. Delete “STD.DAT” file and rename “TEMP.DAT ” as “STD.DAT”
Step 8: Stop
Step 2: open datafile “STD.DAT” in input mode.
Step 3: Display Id, name, class, address, telephone
Step 4: read ID, N$, C, A$, T# OF Student.
Step 5: Display ID, N$, C, A$, T#
Step 6: Are all read from file “STD.DAT”
{No: Go to step 4}
Step 7: stop
Algorithm for searching record
Step 1: start
Step 2: open datafile “STD.DAT” in input mode
Step 3: get SR$
Step 4: Display Id, name, class, address, telephone
Step 5: read ID, N$, C, A$, T# OF Student.
Step 6: is N$ equal to SR$?

1
{Yes: Display Id, name, class, address, telephone }
Step 7: Are all records read from file “STD.DAT” ?
{No: Go to step 5}
Step 8: close “STD.DAT” datafile.
Step 9: Stop
Algorithm for updating record
Step 1: start
Step 2: open datafile “STD.DAT” in input mode and a new datafile “TEMP.DAT” in output mode
Step 3: get UR
Step 4: read ID, N$, C, A$, T# OF Student.
Step 5: is UD equal to DR?
{No: store record in data file “TEMP.DAT
Yes: get ID, N$, C, A$, T# OF Student. store all data in datafile}
Step 6: Are all records read from file “STD.DAT”?
{No: Go to step 4}
Step 7: close both files. Delete “STD.DAT” file and rename “TEMP.DAT ” as “STD.DAT”
Step 8: Stop

You might also like