int atm, choice, txnCode, customerCode;
CUSTOMER temp,rcp, customer[10];
FILE *fptr1, *fptr2, *fptr3;
SYSTEMTIME t;
TxnA tempdep,tempwthdr;
TxnB tempcheq;
TxnC temptransfer;
int temp,tempRec;
void transaction(int TxnCode);
int withdrawal(int balance, int withdraw);
char temp_pw[10],password[]="mama";
int get=0,tryagain=1;
int BANKCODE;
void PrtTxnLog();
void Update();
void WithdrawalLog();
void TransferLog();
void CashDepLog();
void ChequeDepLog();
void transaction(int TxnCode) {
int withdraw, transfer, deposit;
switch(TxnCode) {
//cashdep
case 1: {
//chequedep
}
case 2:{
}
//Withdrawal
case 3: {
printf("WITHDRAWAL\n\n");
printf("Your Balance is RM%d\n", temp.balance);
printf("Please key in the amount you want to withdraw:\nRM");
scanf("%d", &withdraw);
//Update last transaction date & time
GetLocalTime(&t);
customer[customerCode].lastTxn.date = t.wDay;
customer[customerCode].lastTxn.month = t.wMonth;
customer[customerCode].lastTxn.year = t.wYear;
customer[customerCode].lastTxn.hr = t.wHour;
customer[customerCode].lastTxn.min = t.wMinute;
customer[customerCode].lastTxn.sec = t.wSecond;
printf("Withdrawal Successful. Your balance is now RM%d\n", customer[customerCode].balance);
//Rewrite customer's details into a temporary text file
for(int i = 0; i < 10; i++) {
fprintf(fptr2, "%s|%s|%s|%c|%s|%s|%s|%d|%d %d %d %d %d %d\n",
customer[i].accNo, customer[i].PIN, customer[i].name, customer[i].gender,
customer[i].address, customer[i].state, customer[i].contact,
customer[i].balance, customer[i].lastTxn.date, customer[i].lastTxn.month, customer[i].lastTxn.year,
customer[i].lastTxn.hr, customer[i].lastTxn.min, customer[i].lastTxn.sec);
}
break;
}
//Funds Transfer
case 4: {
printf("FUNDS TRANSFER\n\n");
printf("Your Balance is RM%d\n", temp.balance);
printf("Enter the Account Number of the Recipient: ");
scanf("%s", &rcp.accNo);
fflush(stdin);
for(int i = 0; i < 10; i++)
{
fscanf(fptr1, "\n%[^|]|%[^|]|%[^|]|%c|%[^|]|%[^|]|%[^|]|%d|%d%d%d%d%d%d\n",
&customer[i].accNo, &customer[i].PIN, &customer[i].name, &customer[i].gender,
&customer[i].address, &customer[i].state, &customer[i].contact,
&customer[i].balance, &customer[i].lastTxn.date, &customer[i].lastTxn.month, &customer[i].lastTxn.year,
&customer[i].lastTxn.hr, &customer[i].lastTxn.min, &customer[i].lastTxn.sec);
//Check if the results match
if(strcmp(rcp.accNo, customer[i].accNo) == 0)
strcpy(rcp.name, customer[i].name);
}
printf("Receiver Name:%s\n",rcp.name);
//Read and Prompt transfer amount(update is pending)
printf("Enter the amount to Transfer(0 to cancel):\nRM");
scanf("%d", &transfer);
temp.balance = temp.balance - transfer;
printf("Funds Transfer Successful. Your balance is now RM%d\n", temp.balance);
}
break;
}
}
//Withdrawal Calculator
int withdrawal(int balance, int withdraw){
int final;
final = balance - withdraw;
return final;
}
//transfers Calculator
int transfers(int balance, int transfer){
int final;
final = balance - transfer;
return final;
}
int main() {
system("color 8a");
SYSTEMTIME t;
int choice, txnCode;
//TARBANK Logo
//Display Today's Date and Time
GetLocalTime(&t);
printf("\t\tWelcome To TARBANK! Today is %d/%d/%d and \n\
it's %d:%d:%d now.\n\n", t.wDay, t.wMonth, t.wYear, t.wHour, t.wMinute, t.wSecond);