security program or login system

Security is a feature that is common place in all aspects of software, most commonly in “Login” applications. The aim of this part of the software engineering project is to develop a elemental “Login” system.

A brief specification of the software requirement is as follows:

• Program will prompt the user to enter a password (6 digit password i.e. 123456)
• If correct the program will output a message such as:

• “Welcome_ Name of User_”

• If incorrect the program will allow one further input of the code word before terminating the process.

it will be soo cool if stars appear when u type the password i.e. ***** instead of the actual numbers
Last edited on
Yes?
closed account (S6k9GNh0)
Are you asking a question or asking for advice or what?

Or is this some bot topic...

cus am quit new so maybe a guide through it will be soo helpful
Last edited on
bazzy i used this to try and get ***** when i enter the pass word but am getting an error on saying "'_getch': identifier not found"....


while(encrypt != 13)
{
if (encrypt=='\b')
{
password.erase(password.size()-1,1);
cout << "\b \b";
}
else
{
password.push_back(encrypt);
cout << '*';
}
encrypt = _getch();
Last edited on
_getch() isn't a standard function.
I suggest you downloading the curses library and use getch from there
( if you are on Windows pdcurses otherwise ncurses )
Last edited on
Making those cool stars appear is more trouble than it is worth.
Nevertheless, here's something that will get a no-echo password for you.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <iostream>
#include <string>

#if defined(__WIN32__)
  #include <windows.h>

  std::string getpassword()
    {
    std::string result;
    HANDLE      hstdin;
    DWORD       mode;
    BOOL        isconsole;

    hstdin    = GetStdHandle( STD_INPUT_HANDLE );
    isconsole = GetConsoleMode( hstdin, &mode );

    if (isconsole)
      SetConsoleMode( hstdin, mode & ~(ENABLE_ECHO_INPUT) );

    std::getline( std::cin, result );

    if (isconsole)
      SetConsoleMode( hstdin, mode );

    return result;
    }

#else
  #include <unistd.h>
  #include <termios.h>

  std::string getpassword()
    {
    std::string    result;
    struct termios echo;
    struct termios noecho;
    bool           isconsole;

    isconsole = isatty( 0 );

    if (isconsole)
      {
      tcgetattr( 0, &echo );
      noecho = echo;
      noecho.c_lflag &= ~(ECHO);
      tcsetattr( 0, TCSANOW, &noecho );
      }

    std::getline( std::cin, result );

    if (isconsole)
      tcsetattr( 0, TCSANOW, &echo );

    return result;
    }

#endif


int main()
  {
  using namespace std;
  string pwd;

  cout << "Please enter a (fake) password> " << flush;

  pwd = getpassword();

  cout << "\nGood job. Your password is \"" << pwd << "\"\n";

  return 0;
  }

Hope this helps.

(BTW, doing this kind of thing is waaay above your head. Make sure you tell your professor you got the echo-on, echo-off code from the internet, or he won't like you.)
Topic archived. No new replies allowed.