Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- char user[5][25],pass[5][25],again;
- char logUser[25],logPass[25],New[25],change;
- int data=0,choose,i;
- void regis();
- void login();
- void list();
- void update(int x);
- int main(){
- printf("~~~WELCOME~~~");
- list();
- return 0;
- }
- void regis(){
- if(data==5){
- printf("\nAccount Has Been Full\n");
- login();
- }else{
- printf("Registration\n");
- fflush(stdin);
- printf("Enter The Username: ");
- gets(user[data]);
- printf("Enter The Password: ");
- gets(pass[data]);
- data++;
- printf("\nRegister Again? [Y]/[N]: ");
- scanf("%c",&again);
- if(again=='Y'||again=='y'){
- regis();
- }else{
- list();
- }
- }
- }
- void login(){
- printf("\nLogin: \n");
- fflush(stdin);
- printf("Enter The Username: ");
- gets(logUser);
- printf("Enter The Password: ");
- gets(logPass);
- for(i = 0;i < data; i++){
- if(strcmp(logUser,user[i])==0){
- if(strcmp(logPass,pass[i])==0){
- printf("\nLogin Succesfuly\n");
- printf("Change Password [Y/N] ? ");
- scanf("%c",&change);
- if(change == 'y' || change == 'Y'){
- update(i);
- break;
- }else{
- list();
- break;
- }
- break;
- }else{
- printf("Login Failed\n");
- list();
- break;
- }
- }else{
- continue;
- }
- }
- }
- void list(){
- printf("\n1. REGISTER \n2. LOGIN \n3. EXIT PROGRAM");
- printf("\nChoose: ");
- scanf("%d",&choose);
- if(choose==1){
- regis();
- }else if(choose==2){
- login();
- }else{
- printf("\n~~~Thank You~~~\n");
- exit(1);
- }
- }
- void update(int x){
- fflush(stdin);
- printf("Enter The New Password: ");
- gets(New);
- strcpy(pass[x], New);
- printf("Password Has Benn Changed\n");
- list();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement