Please kindly help. the login iv already managed to code need help with this part.

Upon execution of your program, it should first read the user-ids and passwords from a file and create a binary search tree using the user-id as a key (assume unique user-ids for convenience). Once the tree has been built, it should display the following menu:
(1) Add new user
(2) Delete user
(3) Verify user
(4) Print users
(5) Quit
Option (1) and (2) simply add/delete new/existing users. When option (3) is selected, the user is supposed to enter a user-id and a password. Then, you should search the tree and a print message like "Valid User" or "Invalid User". When option (4) is selected, the users and their passwords should be printed out in alphabetical order. Finally, when option (5) is selected, the elements of the binary search tree should be stored to a file and execution should be terminated.

im not sure of the code of how to add, delete, print users.

Actually, the way you accept the input should be seperate from the way you add the user record, if only for modularity's sake. You want to break adding a user record down into five steps:
* input - get the username and password.
* encryption - converting the password into a different form using a hashing function.
* qualification - checking to see if there is already a user with the same name. If there is, disallow the new user account.
* insertion - adding the user account to the binary tree.
* storage - saving the new user record into the password file.

Each of these is itself a seperate operation, and should be at least one seperate function each.

We'll set aside input for now, as that is going to be operating-system dependent (assuming you are going to mask out the characters as they are being typed, at least). Realistically, you want to go at these in reverse order anyway, starting with the code to insert a record into the password file and working back to the data entry. So, you will want to start with by figuring out how you want to store the passwords in the password file.

There are a few different ways of doing this, each with their own advantages and disadvantages. The simplest solution is to just have a text file containing the usernames and password as a line of text separated by a marker such as a colon or a comma. It is a very simple approach that doesn't require a lot of work, but it's not very efficient; still, for your needs it should be adequate. To add a record, you simply append the new record to the file; since you'll have the whole file's data in memory in the binary tree, searching the file isn't an issue. The only real headache is changing a record, as you'll need to re-arrange the entire file. It may be best to simply over-write the whole file from the binary tree every time a password is changed or deleted, which is slow but not unreasonably so for something done as infrequently as that is.

Therefore, I would start by writing a function to insert a password into the file, and read one back from the file. This should be a simple matter seeking to the end of the file, then writing out the username, the seperator character, the password, and a newline. Reading in a password would just be reading in a line, scanning the input for the separator, and taking the part before the substrings before and after the seperator as the username and password.

This article has been dead for over six months. Start a new discussion instead.