Help Me(BST)

Reply

Join Date: Aug 2006
Posts: 1
Reputation: Rosicky is an unknown quantity at this point 
Solved Threads: 0
Rosicky Rosicky is offline Offline
Newbie Poster

Help Me(BST)

 
0
  #1
Aug 4th, 2006
Write a password authentication program using a Binary Search Tree for a fast
username search. Your program must meet the following requirements:
Inputs:
Before doing an authentication, read a file named “authen.pwd” that stores pairs of username and password.
Wait for a command from a user and respond accordingly. For example:
>Add s1limth
passwd: abc123
>Delete s1limth
>Verify s1limth >Verify s1limth
passwd: 321cba passwd: abc123
Invalid Password! Password Confirmed!

>List
s1limth:abc123
s1pornu:456def
>Quit
Outputs:
Update the “authen.pwd” file before exiting the program.
The “authen.pwd” file must conform the following format:
s1limth:abc123
s1pornu:456def
Your program must be named “pwdauth.c” for the source code and
“pwdauth” for the executable.
Last edited by Rosicky; Aug 4th, 2006 at 8:22 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 16,561
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1611
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Help Me(BST)

 
0
  #2
Aug 4th, 2006
if you don't know where to start, here's a hint
  1. int main()
  2. {
  3. // put your code here
  4. }
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,767
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 493
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Help Me(BST)

 
0
  #3
Aug 4th, 2006
YOu have to first post ur effort my friend before expecting any kind of help from the forum members.
I don't accept change; I don't deserve to live.

Sacrifice is a painful, pure and beautiful thing.

Dammit, Jones, What the Hell Are Knoll Pointers?!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 147
Reputation: Grunt has a spectacular aura about Grunt has a spectacular aura about 
Solved Threads: 12
Grunt's Avatar
Grunt Grunt is offline Offline
Junior Poster

Re: Help Me(BST)

 
1
  #4
Aug 4th, 2006
The key to eliminating bugs from your code is learning from your mistakes.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 4,210
Reputation: WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future 
Solved Threads: 400
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Industrious Poster

Re: Help Me(BST)

 
1
  #5
Aug 4th, 2006
Originally Posted by Ancient Dragon
if you don't know where to start, here's a hint
You forgot the return:
  1. int main()
  2. {
  3. // put your code here
  4.  
  5. return 0;
  6. }
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 16,561
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1611
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Help Me(BST)

 
0
  #6
Aug 4th, 2006
no I didn't forget it -- it not required in current c or c++ standards. Default is return 0. But some older compilers will complain.
Last edited by Ancient Dragon; Aug 4th, 2006 at 1:43 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 147
Reputation: Grunt has a spectacular aura about Grunt has a spectacular aura about 
Solved Threads: 12
Grunt's Avatar
Grunt Grunt is offline Offline
Junior Poster

Re: Help Me(BST)

 
0
  #7
Aug 4th, 2006
Originally Posted by Ancient Dragon
no I didn't forget it -- it not required in current c or c++ standards. Default is return 0. But some older compilers will complain.
Right. C99 and C++ adds return 0; automatically.
The key to eliminating bugs from your code is learning from your mistakes.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 4,210
Reputation: WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future WaltP has a brilliant future 
Solved Threads: 400
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Industrious Poster

Re: Help Me(BST)

 
0
  #8
Aug 4th, 2006
Sloppy... Just because it can be done doesn't mean it should...
After all, gets() still exists, doesn't it?
Last edited by WaltP; Aug 4th, 2006 at 4:39 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 147
Reputation: Grunt has a spectacular aura about Grunt has a spectacular aura about 
Solved Threads: 12
Grunt's Avatar
Grunt Grunt is offline Offline
Junior Poster

Re: Help Me(BST)

 
0
  #9
Aug 4th, 2006
Originally Posted by WaltP
Sloppy... Just because it can be done doesn't mean it should...
After all, gets() still exists, doesn't it?
It's a good programming habit to write return 0; at the end but there's no harm in not writing it now.
gets() issue is different. It's a dangerous call.
The key to eliminating bugs from your code is learning from your mistakes.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,767
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 493
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Help Me(BST)

 
0
  #10
Aug 5th, 2006
Originally Posted by WaltP
Sloppy... Just because it can be done doesn't mean it should...
After all, gets() still exists, doesn't it?
Mr. WaltP please see the context in which the comment was made by Mr. Ancient Dragon. He was actually trying to tell the new programmer ie the OP to first post his own effort. It was not sloppy progg.

  1. int main (void)
  2. {
  3. // your code goes here could mean a lot of things
  4. // it can also include the return 0 since its part of the code ;)
  5. }

If u go out to tell the beginner programmer everything in a single post without even knowing his skilll set then even this would not suffice

  1. int main (void)
  2. {
  3. // write some code to take inuput from user
  4. // please dont use scanf () for taking the input since it leaves the
  5. // remaining data in the input stream
  6.  
  7. // avoid usign gets () after scanf () since it may read in the data left
  8. // from the prev scanf attempt.
  9.  
  10. // dont ever try to clear the input stream using fflush (stdin) since its
  11. // behaviour is undefined
  12.  
  13. // and dont forget that main returns an int as a signal to the operting
  14. // system about its execution status.
  15.  
  16. // and many more blah blah blah
  17. }

I hope now u understand teh meaning of Mr.Ancient Dragon's post.

Take care,
Bye.
Last edited by ~s.o.s~; Aug 5th, 2006 at 12:51 pm.
I don't accept change; I don't deserve to live.

Sacrifice is a painful, pure and beautiful thing.

Dammit, Jones, What the Hell Are Knoll Pointers?!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 1082 | Replies: 9
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC