#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
struct User{char user[30];
int pass;
int sodu;};
int main(int argc, char *argv[]) {
struct User data;
data.pass=123456;
data.sodu=1000000;
printf("================Ngan Hang FPT-Aptect=================");
printf("\n\n---------------Hay dua the cua ban vao---------------");
printf("\n\n---------------Nhap ma PIN---------------");
int pass;
int login;
printf("\nMa PIN:");
scanf("%d",&login);
if(login != data.pass){
do{
printf("* Sai! Nhap lai ma pin: ");
scanf("%d",&login);
}while(login != data.pass);}
char menu,smallOption;
int option, newacc, moneyout;
access(login,data);
while ( menu = 'y'){
printf("---Dang kiem tra thong tin---------");
printf("\n=================");
printf("\nXin chao mung Minh.\n1. Kiem tra so du tai khoan.\n2. Rut tien.\n3. Chuyen khoan.\n4. Doi ma PIN\n0. Ket thuc giao dich.\n====================\n", data.user);
int option;
printf ("Lua chon: "); scanf("%d", &option);
int moneyout;
if(option == 1){
printf("So du trong tai khoan : %d VND\n", data.sodu);
printf("Lan giao dich gan nhat: 6/10/2014");
inphieu(smallOption);
printf("\nBan co muon thuc hien tiep giao dich? (Y/N) : ");
scanf("%c", &menu);
}
else if(option == 2){
printf("\nSo du trong tai khoan : %d VND", data.sodu);
printf("\nNhap so tien can rut: ");
scanf("%d",&moneyout);
char a;
printf("\nBan co muon rut so tien nay? (Y/N)");
scanf("\n%c",&a);
if(a == 'y'){
printf("\n...Dang thuc hien rut tien....");
data.sodu = data.sodu - moneyout;
printf("\n...Xong.......");
printf("\nSo du trong tai khoan cua ban la: %d VND\n", data.sodu);
inphieu(smallOption);
printf("\nBan co muon thuc hien tiep giao dich? (Y/N) : ");
scanf("%c", &menu);
}
else if (a =='n'){
return 0;}
}
else if(option == 3){
printf("\nSo du trong tai khoan : %d VND\n", data.sodu);
printf("Nhap tai khoan muon chuyen: "); scanf("%d", &newacc);
printf("So tien muon chuyen: "); scanf("%d", &moneyout);
char a;
printf("Ban muon chuyen so tien nay? (Y/N)");
scanf("\n%c",a);
if(a == 'y'){
printf("\n..........Dang chuyen...........");
data.sodu = data.sodu - moneyout;
printf("\n...Xong.......");
printf("\nSo du trong tai khoan cua ban la: %d VND\n", data.sodu);
inphieu(smallOption);
printf("\nBan co muon thuc hien tiep giao dich? (Y/N) : ");
scanf("%c", &menu);
return 0;}
}
}
void inphieu (char smallOption){
printf("Ban co muon in phieu? (Y/N): ");
scanf("%c", &smallOption);
if(smallOption == 'y'){
printf("\n...Dang in....\n...Da xong......\n");
}
}
}