```/*********************************************
Reads in Bank Account information from BankAccts.txt
and reads in transactions data from Transactions.txt
and prints out account info at end of year.
**********************************************/
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

/*********************************************
** PROTOTYPES & CLASS DEFINITIONS
*********************************************/
struct Account
{
string name;
int number;
double balance;
};

int find(int acctnum, Account *A, int N);

/*********************************************
** MAIN FUNCTION
*********************************************/
int main()
{
ifstream AIN("BankAccts.txt");
int N;
string s;
AIN >> N >> s;
AIN >> s >> s >> s;

Account *A = new Account[N];
char c;
for(int i = 0; i < N; i++)
AIN >> A[i].number >> c >> A[i].balance >> A[i].name;

string date;
int acctnum;
double transamt;
ifstream TIN("Transactions.txt");
while(TIN >> date >> acctnum >> transamt)
{
int i = find(acctnum,A,N);
A[i].balance = A[i].balance + transamt;
}

// Write end-of-year statement
for(int i = 0; i < N; i++)
{
cout << A[i].number << '\t'
<< A[i].name << '\t' << '\$'
<< A[i].balance << endl;
}

return 0;
}

/*********************************************
** FUNCTION DEFINITIONS
*********************************************/
// returns index of Account with number acctnum.
// If none is found, the index N is returned.
int find(int acctnum, Account *A, int N)
{
int k = 0;
while (k < N && A[k].number != acctnum)
k++;
return k;
}

```