-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewCustomerList.h
36 lines (31 loc) · 1.13 KB
/
viewCustomerList.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "updateAccount.h"
void viewCustomersList()
{
FILE *ptr;
fflush(stdin);
int n = 1;
ptr = fopen("List", "rb");
if(ptr == NULL)
{
printf("\nThe database is either deleted or cannot be found.\n\nPlease contact the bank employee. Toll Number: 1800 000 1234\n");
return; //to indicate failure
}
//printing the customer's list
while(fread(&ACC, sizeof(ACC), 1, ptr))
{
printf("\n");
printf("\nCustomer Number: %d", n++);
printf("\nName: %s", ACC.name);
printf("\nMobile Number: %ld", ACC.mobile_number);
printf("\nAccount Number: %ld", ACC.acc_number);
printf("\nI.D. Number: %ld", ACC.id_number);
printf("\nAge: %d", ACC.age);
printf("\nType of account: %s", (ACC.acc_type == 'S')?"Savings":"Current");
printf("\nAccount balance: Rs. %.2f", ACC.acc_balance);
printf("\nAccount blocked: %s", (ACC.acc_functional == false)?"Yes":"No");
}
//closing the file pointer
fclose(ptr);
printf("\n\nPress any key to continue...");
getch();
}