How can you use files to check for a pin number and name ? which is oviously recorded in the file.
Printable View
How can you use files to check for a pin number and name ? which is oviously recorded in the file.
This question makes no sense
I'm going to make a >guess< as to what your question is and specify it, then try to offer hints to help.
I'm assuming you want to know how to search a list of accounts and their pin numbers to cross-reference user input. Via loggin in, or some other mechanism. The subject of this matter is "Databases". Database refers to the use of some medium to store (and typically retrieve) information in an orderly fashion. Guaging by your question, Im going to assume you are new to the idea and recomend using a technique called "flat-file databasing" (rather then ODBC, MySQL etc). Flat-file simply referes to using text like files to store your information in a uniform manner. An example of a database file for bank accounts might resemble:
The file is grouped in something called a "Record". A record is a collection of info relating to a single object (in more advanced databases a Record would consist of all the Columns in one Row).Code:John Doe
555555
1234
Utah
USA
500
Jane Smith
525555
6789
bumfck
egypt
8029
The format of the record in this file is :
first line - name
second line - account number
third line - pin number
fourth line - state
fifth line - country
six line - money ammount
One way to go about getting user information is to write a function that opens the file, and reads the contents into an array of Records (you might make a class or struct for a record).
Later in your program when you want to compare names with passwords (or pins) you use a for loop to sift through the array of records comparing the desired information.
I hope this helps.