Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include "string.h"
- int main()
- {
- FILE*fp;
- char buff[50],user[50],old_user[50],old_pass[50],
- pass[50],new_user[50],new_pass[50];
- printf("Login\nUser:");
- scanf("%[^\n]%*c",&user);
- printf("Pass:");
- scanf("%[^\n]%*c",&pass);
- fp = fopen("C:\\login\\userpas.txt", "r");
- fscanf(fp, "%s", old_user);
- fscanf(fp, "%s", old_pass);
- fclose(fp);
- if(strcmp(user,old_user)==0 && strcmp(pass,old_pass)==0){
- printf("Login Anda Berhasil\n");
- printf("apakah anda ingin mengganti User/pass (ya/tidak)");
- scanf("%[^\n]%*c",&buff);
- if (strcmp(buff,"ya")==0){
- printf("Masukkan User dan Password Baru!\n");
- printf("User Baru:");
- scanf("%[^\n]%*c",&new_user);
- strcat(new_user,"\n");
- printf("Password Baru:");
- scanf("%[^\n]%*c",&new_pass);
- }
- fp = fopen("C:\\login\\userpas.txt", "w+");
- fprintf(fp, new_user);
- fprintf(fp, new_pass);
- fclose(fp);
- printf("User dan Password Baru Berhasil di buat!\n");
- }
- if{
- printf("Login anda Selesai!\n");
- }
- }
- else{
- printf("Login anda Gagal!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement