A program that takes input from user(in form of hidden characters) and compares it with predefined array.. then tells whether the entered input valid or invalid.
Problem: i am unable to break for loop by hitting 'enter button'. Although characters are hidden and comparing but how to stop loop when user hits 'enter' after password.. user can enter 6 or more values that will be compiled as invalid soo.. help me plz
Can I start by having you change a few semi-unlrelated things first?
- First, please use the code tags, they are the "<>" symbol in under the format section to your right.
- Next main(...) should always return an integer never a void. This is part of the current C++ standard.
- You should have usingnamespace std; in the global scope of your code since you are writing as if it is there. Otherwise prefixing the io streams with "std::" would work as well.
- You should flush the input stream before using "getch()" to hold your program open at the end there. This insures that it will not grab a leftover character that was not extracted properly.