int main()
{
    
    char username[9],username1[9];   
    char password [5],pass[5];
    int y=1,i=0;
    
    strcpy(username1,"udental");
    strcpy(password,"1987");
    
    display();
    
    
    do
    {
                 
                  
                  printf("\n\n\n\n\n\n\t\t\tPlease enter your username:");
                  scanf("%s",username);
                  
                  printf("\n\n\n\n\n\t\t\tPlease enter your password:");
                  
                  //problem/probelm
                            while((pass[i]=getch())!='\r')

                               {
                                       printf("*");

                                       i++;

                                }
                                                              
                           if (strcmp(username,username1)==0 &&  strcmp(password,pass) == 0)
                           
                            {
                                Sleep(1000);  
                                system("cls");
                                break;                                                                                                                 
                               
                             } 
                               
                           else 
                           
                            {
                                printf("\n\n\t\t\t YOU HAVE MADE AN INVALID INPUT");
                                printf("\n\n\t\t\t      PLEASE TRY AGAIN\n\n"); 
                                Sleep (1000);
                                system("cls");
                            }                             
                  
                  
                  y++;
                  
     }while(y<4);             
    
     menu(); 
    
    
    
    getch();
    return 0;
}

Recommended Answers

All 2 Replies

Certainly...What's the problem?

Certainly...What's the problem?

at the line marked problem, in the code ,i want to hide the password entered but i don't know if my coding is correct

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.