password help

can you help me debug this?


void logo();
void program_start();
void main_menu();

struct patient
{
char username[40];
char password[];

char first_name[40];
char last_name[40];
char gender;
int age;

char temp_username[40];
char temp_password[40];
char temp_first_name[40];
char temp_last_name[40];


};

int main()
{
program_start();
getch();
}

void program_start()
{
logo();

patient login;

bool Flag_Login;


printf("\t\t\t\tADMIN LOGIN");
printf("\n\n\t%25s ","Username:");
scanf("%s",login.username);

printf("\n\n\t%25s ","Password:");

char c;
int pos = 0;

do {
c = getch();

if(isprint(c))
{
if(pos > 19)
{
continue;
}

login.temp_password[pos++] = c;
printf("%c", '*');
}
else if( c == 8 && pos )
{
login.temp_password[pos--] = '\0';
printf("\b \b");
}
} while( c != 13 );

login.temp_password[pos--] = '\0';

if(login.temp_username == "admin")
{
main_menu();
}
else
{
printf("\n\n\n\n\t\t\t INCORRECT PASSWORD!");
printf("\n\n\t\t\t PRESS ANY KEY TO CONTINUE ");
getch();
program_start();
}

}
it has error
Last edited on
can you help me debug this?

...
...
...
it has error


Uuuhhh, no.
http://cplusplus.com/forum/beginner/1/
placement of getch is wrong in my openion
Last edited on
Topic archived. No new replies allowed.