Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <conio.h>
- int main()
- {
- int i,c;
- int userLogin = 0;
- int firstOption;
- char username[30],loginid[30];
- char password[30],loginpassword[30];
- while(firstOption !=99){
- if(userLogin == 1){//Loggedinview
- printf("EZ Video Rental System\n");
- printf("----------------------------------------------------------------\n");
- printf("Welcome Balraj. Balance : $9999999.9\n\n");
- printf("--------------------------\n");
- printf("1. Video Listing\n");
- printf("2. Checkout\n");
- printf("3. Staff Listing\n");
- printf("4. Edit Profile\n");
- printf("5. Reload\n");
- printf("6. Logout\n");
- printf("99. Exit\n");
- printf("What would you like to do?\nEnter 1-6 | Exit with 99 : ");
- scanf("%d",&firstOption);
- }
- else {//GuestView
- printf("EZ Video Rental System\n");
- printf("----------------------------------------------------------------\n");
- printf("Welcome Guest.\n\n");
- printf("1. Video Listing\n");
- printf("2. Register\n");
- printf("3. Login\n");
- printf("4. Staff Listing\n");
- printf("99. Exit\n");
- printf("What would you like to do?\nEnter 1-5 | Exit with 99 : ");
- scanf("%d",&firstOption);
- system("cls");
- if(firstOption == 2){
- printf("Please enter your desired username : ");
- scanf("%s",&username);
- system("cls");
- printf("Enter your desired password : ");
- for( i = 0; i<=30 && (c = getch()) != '\r'; i++){
- password[i]=c;
- putch('*');
- }
- system("cls");
- }
- else if(firstOption == 3){
- while(userLogin == 0){
- printf("Username : ");
- scanf("%s",loginid);
- system("cls");
- printf("Password : ");
- for( i = 0; i<=30 && (c = getch()) != '\r'; i++){
- loginpassword[i]=c;
- putch('*');
- }
- system("cls");
- if(strcmp(loginid,username) == 0 && strcmp(loginpassword,password) == 0){
- userLogin = 1;
- system("cls");
- }
- else{
- printf("Wrong username or password, try again\n");
- }
- }
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment