memset(&info, 0, sizeof info); read_data(&info); printf("welcome! please login\n"); while(1) { printf("please input your user name\n"); scanf("%s", pw); if(strcmp(pw, info.name) != 0) { printf("no such user name\n"); continue; } printf("please input your password\n"); scanf("%s", pw); if(strcmp(pw, info.pw) != 0) printf("password error\n"); else break; wt ++; if(wt >= 3) { printf("3 times password error, exit!\n"); return -1; } } while(1) { int i;
printf("input 1 to change your password\ninput 0 to exit\n"); scanf("%d", &i); if(i == 0) break; if(i == 1) { while(1) { printf("please input your original password\n"); scanf("%s", pw); if(strcmp(pw, info.pw) != 0) { printf("original password is not correct\n"); continue; } printf("please input your new password\n"); scanf("%s", pw); printf("please confirm your new password\n"); scanf("%s", pw_confirm); if(strcmp(pw, pw_confirm) != 0) { int j; printf("the new passwords are not same in two times input!\n"); while(1) { printf("input 1 to change password again\ninput 2 to back to last step\ninput 0 to exit\n");