Thread: help on code

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    13

    help on code

    #include <stdio.h>
    #include <conio.h>
    #include <string.h>


    void Password (void);

    main()
    {
    Password();
    }
    void Password(void)
    {
    char Passwordin[20];



    gotoxy(30,4);printf("Password Identification");
    gotoxy(17,8);printf("\t\tPlease enter password : ");
    scanf("%s",Passwordin);

    //check if user entered correct password dcampbell using strcmp

    if(strcmp(Passwordin,"dodon")==0)
    {
    gotoxy(17,10);printf("Correct Password ");
    getch();
    }
    else
    {
    // if password incorrect Password function recalled until correct Password entered
    gotoxy(17,10);printf("\t\tincorrect password\n");
    getch();
    Password();
    }

    }

    The above code when u enter an incorrect password, the program halts and wont give me the option of re-entering a password - any ideas? also how would you be able to have ***** appear on screen as the password being entered instead of the text appearing on screen? cheers

  2. #2
    Registered User alex6852's Avatar
    Join Date
    Sep 2001
    Posts
    43

    Lightbulb

    To make code that would ask to reenter password just put your codw in the infinite loop (while(true) { ..... }; for example).

    Now if you whant ******** do the following:

    char ch[10];
    for(int i=0; i<10; i++)
    {
    char[i] = getch();
    cout << "*";
    {

    that should do it.
    C++ rulez!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM