Banks lend money to each other. The assets of a bank consist of the balances of the accounts it holds plus the loans it has granted to other banks. If a bank's assets are below a certain known limit, the bank is not considered safe. Consider that the limit limit, in order to be considered a bank safe, is fixed at the beginning of the program.
Define a structure with bank name and members as follows:
1. Bank code, positive int type with allowed values ​​of 1-10
2. Balance of retained accounts (in millions of euros) in it, positive int type
3. 10 positive value pairs (int, int) containing the bank's loan code and the corresponding amount (int type number representing a loan in millions of euros).
A serial file called bankfile.txt contains 10 records, one for each bank. Example for the bank with code 1, the data in the file is (parentheses are not in the file):
1, 145, (1,0), (2,70), (3,0), (4,0), (5,120), (6,0), (7,15), (8,44) (9.0), (10.0)
A bank bank structure contains the data for all banks. The data in the table of structures is entered by accessing the bankfile.txt serial file.
Using all the objects in the table of structures:
1. Create and display a new int table that will contain, in the form of pairs, which of the 10 banks are not considered safe, ie their assets as originally set are lower than the limit value, as well as the the amount required for each bank to make it safe. In the calculations you will include all the banks that have been granted loans.
example
For the example of bank 1 the asset is: 145 + (70 + 120 + 15 +44) = 394
If limit = 300 then the bank is safe, and bank 1 will not be included in the new table.
If limit = 500 then the bank is not secure and the table will include the pair (1,106) (the remaining amount is 500-394 = 106)
FILE * fp;
errno_t err;
...
if (err = (fopen_s (& fp, filename, mode))! = 0)
{
printf ("error reading file .... \ n");

exit (1);
}