"Sigi" <kk*******@yahoo.co.uk> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi guys. I am new member in this group. I am also new to Visual C++. I
am developing a new system. I have a password to enter the system. The
user should have a choice to change his/her password anytime. The
password should be 8 char ending with an #. Could someone help me &
show how it is done.
What part do you need help with? What do you have so far?
Sounds like a homework assignment. I find it difficult to believe you're
developing an entire "system", but don't know how to have the user enter a
string. If it's not homework, then why make the password exactly 8
characters, and why add the # at the end? Those rules seem arbitrary, and
make the password less secure than a variable-length password.
Break the task into parts. First write a function that lets a user enter a
string. (Preferably, use std::string, unless you're required to use char
arrays for this.)
Then write another function that calls the first function, checks that it's
8 characters long plus the # at the end. If it doesn't meet those
requirements, have this second function loop, calling that first function
until the user gets it right. (You could provide some kind of special
keyword the user could enter that would cancel the operation, if desired.)
Finally, you'll need to write the "system" which allows the user to specify
that they *want* to change their password, including some way to store that
password (and I would assume some way to "log on" to the system in the first
place). But if this is homework as I suspect, you won't be writing that
part.
By the way, if you're wondering how to do like most password systems, and
show # or * characters instead of the characters the user is typing while
entering the password, you'll need to step outside standard C++ and use some
platform-specific features, since C++ doesn't provide facilities for that
kind of keyboard handling.
-Howard