Advertisement
Guest User

project

a guest
Jul 16th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.14 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<conio.h>
  4. #include<stdlib.h>
  5. #define ENTER 13
  6. //subfunction diclaration
  7. void login();
  8. void menu();
  9. int main()
  10. {
  11.     login();
  12.     return 0;
  13. }
  14. void login()
  15. {
  16.     int i;
  17.     char password[100],ch;
  18.     char username[100];
  19.     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");
  20.     printf("\n\t\t\tUSERNAME:");
  21.     scanf("%s",&username);
  22.     printf("\n\t\t\tPASSWORD:");
  23.  
  24.     for(i=0; i<100; i++)      //loop for password input
  25.  
  26.     {
  27.         ch = getch();       //getch don't showing input from user
  28.         if(ch==ENTER)
  29.         {
  30.            break;
  31.         }
  32.  
  33.         else {
  34.             password[i] = ch;
  35.         ch = '*' ;
  36.         printf("%c",ch);
  37.         }
  38.  
  39.     }
  40.  
  41.     password[i] = '\0';       //in string last character is a null character
  42.     if(strcmp(username,"abc")==0)   // strcmp for compearision
  43.     {
  44.  
  45.  
  46.         if(strcmp(password,"123")==0)
  47.         { getch();
  48.         system("CLS");
  49.             printf("\n\n\t\tSUCCESSFULLY LOG IN......");
  50.              printf("\n\n\t\tPress Any Key To Countinue..... ");
  51.              getch();
  52.         system("CLS");
  53.               menu();   // call menu function
  54.         }
  55.         else
  56.         {
  57.             printf("\n\n\t\tPlease Enter Correct Password.....");
  58.             printf("\n\n\t\tPress Any Key To Countinue..... ");
  59.             getch();
  60.         system("CLS");
  61.          login();    // call login function
  62.         }
  63.  
  64.  
  65.     }
  66.     else
  67.     {
  68.         printf("\n\n\t\tPlease Enter Correct Username.....");
  69.         printf("\n\n\t\tPress Any Key To Countinue..... ");
  70.         getch();
  71.         system("CLS");
  72.         login();
  73.     }
  74.  
  75.  
  76.  
  77.  
  78. }
  79.  
  80. void menu()
  81. {
  82.     int choise,quite;
  83.     printf("\n\n\t\t   ======WELCOME TO BLOOD GROUP MANAGEMENT======\n");
  84.     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*");
  85.     printf("\n\t\t\t*\t  [1]Data Entry\t\t*\n");
  86.     printf("\t\t\t*\t  [2]Search\t\t*\n");
  87.     printf("\t\t\t*\t  [3]Delete\t\t*\n");
  88.     printf("\t\t\t*\t  [4]About\t\t*\n");
  89.     printf("\t\t\t*\t  [5]Exit\t\t*\n");
  90.     printf("\t\t\t*\t  [1]Data Entry\t\t*\n\t\t\t*\t\t\t\t*\n");
  91.     printf("\t\t\t*********************************\n\n");
  92.     printf("\t\t\t\tChoise Any Number: ");
  93.  
  94.     scanf("%d",&choise);
  95.     system("CLS");
  96.     switch(choise)
  97.     {
  98.     case 5:
  99.         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*********************************");
  100.         printf("\n\n\t\t\tChoise Any Number: ");
  101.         scanf("%d",&quite);
  102.         if(quite==1)
  103.         {
  104.         system("CLS");
  105.         printf("\n\n\n\n\n\n\t\t\t*********Thanks For Using*********\n\n\n\n\n\n\n\n\n\n\n");
  106.             break;
  107.         }
  108.         else
  109.         {
  110.  
  111.         system("CLS");
  112.             menu();
  113.         }
  114.  
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement