Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void accounts(void){
  5. FILE *fp;
  6. fp = fopen()
  7. int selection;
  8. while(selection!=3){
  9. printf("0)Check accounts\n1)Add an account\n2)Remove an account\n3)Quit\n");
  10. scanf("%d",&selection);
  11. if(selection=){
  12. check();
  13. }
  14. else if(selection=){
  15. add();
  16. }
  17. else if(selection=){
  18. remove();
  19. }
  20. }
  21. }
  22. int main(void){
  23. char user[]="test",pass[]="123"; //user log in info
  24. char user_input[20],pass_input[20];
  25. int count = 3; //count for number of tries
  26.  
  27. while(count!=0){
  28. printf("You have %d attempts left\n",count);
  29. printf("Username: "); //user input of user/Password
  30. gets(user_input);
  31. printf("Password: ");
  32. gets(pass_input);
  33.  
  34. int user_comp,pass_comp; //variables for comparing strs
  35. user_comp = strcmp(user_input,user);
  36. pass_comp = strcmp(pass_input,pass);
  37.  
  38. if(user_comp==0&&pass_comp==0){
  39. printf("Login successful\n");
  40. accounts();
  41. }
  42. else{
  43. printf("Invalid login\n");
  44. count--;
  45. }
  46. }
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement