Guest User

Untitled

a guest
Dec 9th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.04 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <conio.h>
  5.  
  6.  
  7.    
  8.  
  9. int main()
  10. {
  11.     int i,c;
  12.     int userLogin = 0;
  13.     int firstOption;
  14.     char username[30],loginid[30];
  15.     char password[30],loginpassword[30];
  16.    
  17.     while(firstOption !=99){
  18.     if(userLogin == 1){//Loggedinview
  19.         printf("EZ Video Rental System\n");
  20.         printf("----------------------------------------------------------------\n");
  21.         printf("Welcome Balraj. Balance : $9999999.9\n\n");
  22.         printf("--------------------------\n");
  23.         printf("1. Video Listing\n");
  24.         printf("2. Checkout\n");
  25.         printf("3. Staff Listing\n");
  26.         printf("4. Edit Profile\n");
  27.         printf("5. Reload\n");
  28.         printf("6. Logout\n");
  29.         printf("99. Exit\n");
  30.         printf("What would you like to do?\nEnter 1-6 | Exit with 99 : ");
  31.         scanf("%d",&firstOption);
  32.         }
  33.     else {//GuestView
  34.         printf("EZ Video Rental System\n");
  35.         printf("----------------------------------------------------------------\n");
  36.         printf("Welcome Guest.\n\n");
  37.         printf("1. Video Listing\n");
  38.         printf("2. Register\n");
  39.         printf("3. Login\n");
  40.         printf("4. Staff Listing\n");
  41.         printf("99. Exit\n");
  42.         printf("What would you like to do?\nEnter 1-5 | Exit with 99 : ");
  43.         scanf("%d",&firstOption);
  44.         system("cls");
  45.             if(firstOption == 2){
  46.                 printf("Please enter your desired username : ");
  47.                 scanf("%s",&username);
  48.                 system("cls");
  49.                 printf("Enter your desired password : ");
  50.                 for( i = 0; i<=30 && (c = getch()) != '\r'; i++){
  51.                     password[i]=c;
  52.                     putch('*');
  53.                 }
  54.                 system("cls");
  55.             }
  56.             else if(firstOption == 3){
  57.                 while(userLogin == 0){
  58.                     printf("Username : ");
  59.                     scanf("%s",loginid);
  60.                     system("cls");
  61.                     printf("Password : ");
  62.                     for( i = 0; i<=30 && (c = getch()) != '\r'; i++){
  63.                     loginpassword[i]=c;
  64.                     putch('*');
  65.                     }
  66.                     system("cls");
  67.                     if(strcmp(loginid,username) == 0 && strcmp(loginpassword,password) == 0){
  68.                     userLogin = 1;
  69.                     system("cls");
  70.                     }
  71.                     else{
  72.                         printf("Wrong username or password, try again\n");
  73.                     }
  74.                 }
  75.             }
  76.         }
  77.     }
  78.     return 0;
  79. }
Add Comment
Please, Sign In to add comment