code
code
h>
#include<conio.h>
#include<string.h>
#include<windows.h>
#include<stdlib.h>
struct TaiKhoan {
char Ten[50];
int SoThe;
int MaPIN;
int SoDu;
int nap, rut, chuyen, nhan;
int tiennap[50], tienrut[50], tienchuyen[50], tiennhan[50];
};
char s[20];
/* do
{
gotoxy(13+i,3);s[i] = getch();
gotoxy(13+i,3);printf("*");
i++;
} while(s[i-1]!=13);*/
danhsachTK[*soluong].nap = danhsachTK[*soluong].rut =
danhsachTK[*soluong].chuyen = danhsachTK[*soluong].nhan = 0;
(*soluong)++;
LuuTep(danhsachTK, *soluong);
printf("\nDa tao tai khoan thanh cong!\n");
}
char c;
while ((c = getch()) != '\r')
{
if (c == '\b')
{
if (y > 0)
{
y /= 10;
printf("\b \b");
}
} else if (c >= '0' && c <= '9') {
y = y* 10 + (c - '0');
printf("*");
}
}
if (y == danhsachTK[i].MaPIN) {
for (int j = i; j < *soluong - 1; j++)
danhsachTK[j] = danhsachTK[j + 1];
(*soluong)--;
LuuTep(danhsachTK, *soluong);
printf("\nTai khoan da bi xoa!\n");
return;
} else {
printf("\nSai ma PIN!\n");
return;
}
}
}
printf("Khong tim thay so the!\n");
}
if (y == danhsachTK[i].MaPIN) {
*chiso = i;
printf("Dang nhap thanh cong!\n");
return 1;
} else {
printf("Sai ma PIN!\n");
return 0;
}
}
}
printf("Khong tim thay so the!\n");
return 0;
}
char lich_su_GD[100][50];
int so_luong_GD = 0;
if (soTien <= 0) {
printf("So tien khong hop le!!\n");
return;
}
danhsachTK[chiso].SoDu += soTien;
ghi_giao_dich("Da nap tien",
danhsachTK[chiso].tiennap[danhsachTK[chiso].nap] = soTien);
danhsachTK[chiso].nap++;
LuuTep(danhsachTK, soluong);
}
void rut_tien(TK danhsachTK[], int soluong, int chiso) {
int so_tien;
printf("Nhap so tien muon rut: ");
scanf("%d", &so_tien);
if (so_tien > danhsachTK[chiso].SoDu) {
printf("So du khong du!\n");
} else {
ghi_giao_dich("Da rut tien",danhsachTK[chiso].SoDu -= so_tien);
LuuTep(danhsachTK, soluong);
if (NhapMAPIN != danhsachTK[chisonguoidung].MaPIN) {
printf("Sai ma PIN. Khong the doi.\n");
return;
}
if (MAPINMOI != XACNHANPIN) {
printf("Xac nhan ma PIN khong khop.\n");
return;
}
danhsachTK[chisonguoidung].MaPIN = MAPINMOI;
LuuTep(danhsachTK, soluong);
FILE *f = fopen("D:\\pin_change.txt", "a");
if (f == NULL) {
printf(" luu thay doi ma PIN.\n");
return;
}
fprintf(f, "So the: %d, Ma PIN moi: %d\n",
danhsachTK[chisonguoidung].SoThe,
danhsachTK[chisonguoidung].MaPIN);
fclose(f);
if (indexNhan == -1) {
printf("Khong tim thay tai khoan nhan!\n");
return;
}
if (soTien <= 0) {
printf("So tien khong hop le!\n");
return;
}
if (soTien > danhsachTK[chiso].SoDu) {
printf("So du khong du!\n");
return;
}
danhsachTK[chiso].SoDu -= soTien;
danhsachTK[indexNhan].SoDu += soTien;
danhsachTK[chiso].tienchuyen[danhsachTK[chiso].chuyen] = soTien;
danhsachTK[chiso].chuyen++;
danhsachTK[indexNhan].tiennhan[danhsachTK[indexNhan].nhan] =
soTien;
danhsachTK[indexNhan].nhan++;
LuuTep(danhsachTK, soluong);
printf("========================================
===\n");
int luachon;
printf("Nhap lua chon: ");
scanf("%d", &luachon);
switch (luachon) {
case 1:
dangnhap = DangNhap(danhsachTK, soluong,
&chisonguoidung);
system("cls");
printf("\t\t\t\tDANG NHAP TAI KHOAN CUA BAN\n\
n");
printf("Dang kiem tra thong tin...\n");
Sleep(1000);
printf("\nDANG NHAP THANH CONG!\a\a\n\n");
Sleep(2000);
system("cls");
break;
case 2:
ThemTaiKhoan(danhsachTK, &soluong);
break;
system("cls");
case 3:
system("cls");
Xoatk(danhsachTK, &soluong);
break;
default:
printf("Lua chon khong hop le.\n");
}
}
int b = 1;
while (b) {
printf("=================== MENU
===================\n");
printf("| 1. Xem tai khoan |\n");
printf("| 2. Nap tien |\n");
printf("| 3. Rut tien |\n");
printf("| 4. Chuyen tien |\n");
printf("| 5. Xem lich su giao dich |\n");
printf("| 6. Doi ma pin |\n");
printf("| 0. Thoat |\n");
printf("========================================
===\n");
int luachon;
printf("Nhap lua chon: ");
scanf("%d", &luachon);
switch (luachon) {
case 1:
system("cls");
printf("\nThong tin tai khoan cua ban:");
printf("\nTen: %s, So The: %d, So Du: %d\n",
danhsachTK[chisonguoidung].Ten, danhsachTK[chisonguoidung].SoThe,
danhsachTK[chisonguoidung].SoDu);
break;
case 2:
system("cls");
NapTien(danhsachTK, soluong, chisonguoidung);
break;
case 3:
system("cls");
rut_tien(danhsachTK, soluong, chisonguoidung);
break;
case 4:
system("cls");
ChuyenTien(danhsachTK, soluong, chisonguoidung);
break;
case 5:
system("cls");
in();
break;
case 6:
system("cls");
DoiMaPIN( danhsachTK, chisonguoidung, soluong);
break;
case 0:
system("cls");
b = 0;
printf("Thoat chuong trinh.\n");
break;
default:
printf("Lua chon khong hop le.\n");
}
XemCT();
}
return 0;
}