Thread: Secure entry keypad simulator

  1. #1
    Registered User
    Join Date
    Feb 2015
    Posts
    9

    Secure entry keypad simulator

    We've been tasked write a code which would mimic a secure entry keypad..
    Only recognising the digits 0-9 for the passcode, and non-numerics S (start again) C (clear last digit) and E (enter) for the control. All other key strokes are to be ignored.

    The passcode has to be <10 digits and represented on the screen by "****", with any keystrokes >10 ignored.
    The valid passcode being 4 digits (1234).

    With 3 attempts to get the correct pass code, after each fail attempt as please try again message show, where after the 3rd attempt a specific message is displayed and an alarm sounds..

    How would I do the "******"? And well how should I attack it??

    Any help is gratefully received.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Is this supposed to be in C or C++? I notice that you posted this after posting the same thing in the C++ programming forum.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2015
    Posts
    9
    It's to be coded in C. being new to the forum I posted it in both. But yes it's to be coded in C apologies
    Last edited by cchivers1; 02-15-2015 at 11:47 AM.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Right. Are you permitted to use third party libraries? After all, your requirements have a scope that lies outside of what is provided by standard C.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered Superuser nul's Avatar
    Join Date
    Nov 2014
    Location
    Earth
    Posts
    53
    Also, the term secure is vague. What specifically does secure imply for this assignment?

  6. #6
    Registered User
    Join Date
    Feb 2015
    Posts
    9
    "Secure" is implied loosely as its only a college assignment, however the general idea is that the simulation will only show the "access granted" message upon the entry of the correct passcode, which as it goes is 4 digits and "1234".

    And is say, to be safe that the code should probably fall within the remit of standard C code.

  7. #7
    Registered User
    Join Date
    Feb 2015
    Posts
    9
    if the requirement does fall outside of standard C, then Yea I'm confident we can use it.

    Any help is very well received.. If I could post pictures to thing page id show the assignment brief and that would help no end im sure
    Last edited by cchivers1; 02-15-2015 at 12:42 PM.

  8. #8
    Registered User
    Join Date
    Sep 2014
    Location
    SE Washington State
    Posts
    65
    Let me see if I understand;
    Hit a key, remember the value, display a '*'.
    Do that four times to get a four digit number, displaying '****'.
    Allow three cycles before sounding an alarm but interupt that loop if the correct sequence is entered.
    The "control" keys are 'E', 'C' and 'S'.

    What OS and platform are you coding for?
    Last edited by PaulS; 02-15-2015 at 01:45 PM.

  9. #9
    Registered User
    Join Date
    Feb 2015
    Posts
    9
    Yes mate that's the general gist of it. But also allowing no more than 10 characters to displayed as ********* as digits are typed, as obviously the theoretically folk using it wouldn't know the correct passcode.
    But yea you're on the money with that description

    Coding in C on visual studio 2010, and Windows
    Last edited by cchivers1; 02-15-2015 at 02:32 PM.

  10. #10
    Registered User Al3's Avatar
    Join Date
    Nov 2014
    Posts
    135
    Coding in C under Windows is like cooking in the toilet by the way. Just to sidenote a bit. I felt like.

  11. #11
    Registered User
    Join Date
    Feb 2015
    Posts
    9
    So I've been told.. Sadly it's the platform we have to use.

  12. #12
    Registered User
    Join Date
    Feb 2015
    Posts
    9
    Any thoughts guys??

  13. #13
    Registered User
    Join Date
    Nov 2012
    Posts
    1,393
    Quote Originally Posted by cchivers1 View Post
    And is say, to be safe that the code should probably fall within the remit of standard C code.
    To solve this you will need to use a third party library or to use operating-system specific techniques to read from the console. For some examples of how to do this with Windows specific code you could see this thread

    how to display * for input password - C++ Forum

  14. #14
    Registered User
    Join Date
    Feb 2015
    Posts
    11
    Just patiently wait or use a library.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 4x4 keypad problems
    By Baaaaboooon in forum C Programming
    Replies: 1
    Last Post: 01-22-2014, 10:04 AM
  2. LCD Menu integration with 4x4 keypad (c programming)
    By unexpert in forum C Programming
    Replies: 5
    Last Post: 03-01-2010, 10:39 AM
  3. simulating alt+2 (keypad) combination
    By kangekraam in forum C++ Programming
    Replies: 2
    Last Post: 11-21-2009, 03:42 AM
  4. question related to keypad
    By lovemagix in forum C++ Programming
    Replies: 22
    Last Post: 01-05-2006, 02:25 AM