Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<conio.h>
- #include<stdlib.h>
- #define ENTER 13
- //subfunction diclaration
- void login();
- void menu();
- int main()
- {
- login();
- return 0;
- }
- void login()
- {
- int i;
- char password[100],ch;
- char username[100];
- printf("\n\n\t\t*************************************************\n\t\t*\t\t\t\t\t\t*\n\t\t*\tENTER YOUR USERNAME AND PASSWORD\t*\n\t\t*\t\t\t\t\t\t*\n\t\t*************************************************\n");
- printf("\n\t\t\tUSERNAME:");
- scanf("%s",&username);
- printf("\n\t\t\tPASSWORD:");
- for(i=0; i<100; i++) //loop for password input
- {
- ch = getch(); //getch don't showing input from user
- if(ch==ENTER)
- {
- break;
- }
- else {
- password[i] = ch;
- ch = '*' ;
- printf("%c",ch);
- }
- }
- password[i] = '\0'; //in string last character is a null character
- if(strcmp(username,"abc")==0) // strcmp for compearision
- {
- if(strcmp(password,"123")==0)
- { getch();
- system("CLS");
- printf("\n\n\t\tSUCCESSFULLY LOG IN......");
- printf("\n\n\t\tPress Any Key To Countinue..... ");
- getch();
- system("CLS");
- menu(); // call menu function
- }
- else
- {
- printf("\n\n\t\tPlease Enter Correct Password.....");
- printf("\n\n\t\tPress Any Key To Countinue..... ");
- getch();
- system("CLS");
- login(); // call login function
- }
- }
- else
- {
- printf("\n\n\t\tPlease Enter Correct Username.....");
- printf("\n\n\t\tPress Any Key To Countinue..... ");
- getch();
- system("CLS");
- login();
- }
- }
- void menu()
- {
- int choise,quite;
- printf("\n\n\t\t ======WELCOME TO BLOOD GROUP MANAGEMENT======\n");
- printf("\n\n\t\t\t*********************************\n\t\t\t*\t\t\t\t*\n\t\t\t*\t Main Menu \t*\n\t\t\t*\t\t\t\t*\n\t\t\t*********************************\n\t\t\t*\t\t\t\t*");
- printf("\n\t\t\t*\t [1]Data Entry\t\t*\n");
- printf("\t\t\t*\t [2]Search\t\t*\n");
- printf("\t\t\t*\t [3]Delete\t\t*\n");
- printf("\t\t\t*\t [4]About\t\t*\n");
- printf("\t\t\t*\t [5]Exit\t\t*\n");
- printf("\t\t\t*\t [1]Data Entry\t\t*\n\t\t\t*\t\t\t\t*\n");
- printf("\t\t\t*********************************\n\n");
- printf("\t\t\t\tChoise Any Number: ");
- scanf("%d",&choise);
- system("CLS");
- switch(choise)
- {
- case 5:
- printf("\n\n\n\t\t\t*********************************\n\t\t\t*\t Are you sure?\t*\n\t\t\t*********************************\n\t\t\t*\t[1]YES *\t[2]NO *\n\t\t\t*********************************");
- printf("\n\n\t\t\tChoise Any Number: ");
- scanf("%d",&quite);
- if(quite==1)
- {
- system("CLS");
- printf("\n\n\n\n\n\n\t\t\t*********Thanks For Using*********\n\n\n\n\n\n\n\n\n\n\n");
- break;
- }
- else
- {
- system("CLS");
- menu();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement