Thursday, 13 December 2012

How to create Login Function using C/C++ program


Write this program in Turbo C++ or DEV C++ and Compile/Run it.

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main(){
    char a[20];
    
    printf("Enter Password:");
    gets(a);
    
    if(strcmp("asif",a)==0){
                        printf("User: Asif\nLoagin Successfuly!");
    }
    else if(strcmp("1415",a)==0){
                        printf("User: 1415\nLoagin Successfuly!");
    }
    else{
                        printf("Invalaid Password!");
    }  
    getch();
    return 0;
}


Output:
Enter Password:asif
User:Asif
Loagin Successfuly

Enter Password:1415
User:1415
Loagin Successfuly

Enter Password:user
Invalaid Password!

Thanks for watching...
Comment it.

No comments:

Post a Comment