Advertisement
Guest User

Untitled

a guest
Mar 13th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.     char *name = 0;
  8.     char *pass = 0;
  9.     while(1)
  10.     {
  11.         if(name) printf("name adress: %x\nname: %s\n",name,name);
  12.         if(pass) printf("pass address: %x\npass: %s\n",pass,pass);
  13.         printf("1: Username\n");
  14.         printf("2: Password\n");
  15.         printf("3: Reset\n");
  16.         printf("4: Login\n");
  17.         printf("5: Exit\n");
  18.         printf("Selection? ");
  19.         int num = 0;
  20.         scanf("%d", &num);
  21.         switch(num)
  22.         {
  23.             case 1:
  24.                 name = malloc(255*sizeof(char));
  25.                 printf("Insert Username: ");
  26.                 scanf("%254s", name);
  27.                 if(strcmp(name,"root") == 0)
  28.                 {
  29.                     printf("root not allowed.\n");
  30.                     strcpy(name,"");
  31.                 }
  32.                 break;
  33.             case 2:
  34.                 pass = malloc(255*sizeof(char));
  35.                 printf("Insert Password: ");
  36.                 scanf("%254s", pass);
  37.                 break;
  38.             case 3:
  39.                 free(name);
  40.                 free(pass);
  41.                 break;
  42.             case 4:
  43.                 if(strcmp(name,"root") == 0)
  44.                 {
  45.                     printf("WINRAR\n");
  46.                     exit(0);
  47.                 }
  48.                 break;
  49.             case 5:
  50.                 exit(0);
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement