Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- void accounts(void){
- FILE *fp;
- fp = fopen()
- int selection;
- while(selection!=3){
- printf("0)Check accounts\n1)Add an account\n2)Remove an account\n3)Quit\n");
- scanf("%d",&selection);
- if(selection=){
- check();
- }
- else if(selection=){
- add();
- }
- else if(selection=){
- remove();
- }
- }
- }
- int main(void){
- char user[]="test",pass[]="123"; //user log in info
- char user_input[20],pass_input[20];
- int count = 3; //count for number of tries
- while(count!=0){
- printf("You have %d attempts left\n",count);
- printf("Username: "); //user input of user/Password
- gets(user_input);
- printf("Password: ");
- gets(pass_input);
- int user_comp,pass_comp; //variables for comparing strs
- user_comp = strcmp(user_input,user);
- pass_comp = strcmp(pass_input,pass);
- if(user_comp==0&&pass_comp==0){
- printf("Login successful\n");
- accounts();
- }
- else{
- printf("Invalid login\n");
- count--;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement