0% found this document useful (0 votes)
45 views2 pages

Create File Pointers

The document provides an algorithm for an ATM card machine program with the following functions: 1) Add an account with a pin code and initial balance, 2) Check an account balance with a pin code, 3) Change a pin code by writing new data to a temporary file and overwriting the original file, 4) Withdraw money by calculating a new balance and writing updated data to a temporary file to overwrite the original file, and 5) Exit the program. The algorithm uses file pointers and input/output operations to manage account data stored in a text file.

Uploaded by

Venn Joe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views2 pages

Create File Pointers

The document provides an algorithm for an ATM card machine program with the following functions: 1) Add an account with a pin code and initial balance, 2) Check an account balance with a pin code, 3) Change a pin code by writing new data to a temporary file and overwriting the original file, 4) Withdraw money by calculating a new balance and writing updated data to a temporary file to overwrite the original file, and 5) Exit the program. The algorithm uses file pointers and input/output operations to manage account data stored in a text file.

Uploaded by

Venn Joe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

VEN JOE CANUMAY

ALGORITHM FOR ATM CARD MACHINE

*Declare Variables
*Create File Pointers
*Display Menu
*Receive value for menu
If option == 1
 ADD ACCOUNT
Open [Link] as append
Enter pin code you want to add
Enter the amount u have on your atm
Print on the [Link]
Close file

If option == 2
 CHECK BALANCE
Open [Link] as read
Enter pin code u want to show balance
Display the balance
Close file

If option == 3
 CHANGE PIN CODE
Open [Link] as read
Open [Link] as write
Enter your old pin code
Scan the pin code in [Link]
If the pin code you entered is equal to the text file
Enter your new pin code
Print the pin code to the [Link]
Close both files
Open [Link] as write, open [Link] as read
Create a loop to scan the [Link]
Scan the [Link] and print all the text on the [Link]
Close both files

If option == 4
 WITHDRAW
Open [Link] as read
Open [Link] as write
Enter pin code
Create a loop to find the pin code you entered is in [Link]
If entered correct pin code, proceed
Enter the amount to withdraw
Use operation to compute for withdraw (nb = cb - amt;)
Print the amount withdrawed, print your new balance
Print it to [Link]
Close both files
Open [Link] as write
Open [Link] as read
Create a loop to scan the [Link]
Then Print all the text in the [Link]
Close both files

If option == 5
 EXIT
Exit the program

You might also like