Assistance needed with code

This is a school project and i need help on fixing this. I think the problem is with BankRegOut but i do not know why or how to fix it, could i get some insight please? Any information i forgot or is needed please inform me and i shall post it.

-BankingMenu.cpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include "stdafx.h"
#include "BankRegister.h"
#include <string>
#include <iostream>
#include <fstream>
#include <stdio.h>      
#include <stdlib.h>     
#include <time.h>
#include <sstream>

using namespace std;
const int InitialAccountNumber = 1000;

int idgen(ofstream &BankRegOut)
{
	
	int gen[8];
	string s[8];
	srand (time(NULL));
	cout <<"Bank ID: ";
	for (int i=0; i<8; i++)
	{
		gen[i] = rand() % 10 + 0;
		s[i] = to_string(gen[i]);
		cout << gen[i];
		BankRegOut<<s[i];
	}
	BankRegOut<<"\n";
	cout <<endl;
	return 0;
}

int menu(int &Bankchoice)
{
	
	cout << "-----------------------------------"<<endl;
	cout << "----------Banking System-----------"<<endl;
	cout << "-----------------------------------"<<endl;
	cout << "1 - Register new account"<<endl;
	cout << "2 - Withdraw from account"<<endl;
	cout << "3 - Deposit to account"<<endl;
	cout << "4 - Check bank balance"<<endl;
	cout << "5 - Bank account information"<<endl;
	cout << "Choose a number: ";
	cin >> Bankchoice;
	cin.ignore(numeric_limits<streamsize>::max(),'\n');
	return 0;
}

int main()
{
	int loop=0;
	string strLine;
	int Bankchoice;
	ifstream BankRegIn;
	ofstream BankRegOut ("bankreg.txt");
	BankRegIn.open("bankreg.txt",ios::app); // in
	string names[4];
	string strFN;
	string strLN;
	BANKSYS BVALS;
	string strValue;
	//BankRegOut.open("bankreg.txt"); // out
	menu(Bankchoice);
	switch(Bankchoice)
	{
	case 1:
		cout << "Insert your First Name:";
		getline(cin,strFN);
		BankRegOut << strFN <<"\n" ;
		BVALS.setCustomerFirstName(strFN);
		cout << "Insert your Last Name:";
		getline(cin,strLN);
		BankRegOut << strLN <<"\n" ;
		BVALS.setCustomerLastName(strLN);
		cout <<endl;
		cout << "------------------------------------------------------\n";
		cout << "---------Registered Bank Account Information----------\n";
		cout << "------------------------------------------------------\n";
		cout << "First Name:" <<BVALS.getCustomerFirstName()<< endl;
		cout << "Last Name:" << BVALS.getCustomerLastName()<<endl;
		idgen(BankRegOut);
		cout << "Initial Account Money: R$1000"<<endl;
		BankRegOut << InitialAccountNumber;
		break;
	case 2:
		while(getline( BankRegIn, strLine ))
		{
			names[loop] = strLine;
			cout << names[loop] << endl;
			loop++;
		}
		cout << names [0]<<names[1]<<names[2]<<names[3];
		break;
	case 3:
		break;
	case 4:
		break;
	case 5:
		break;
	}
	BankRegOut.close();
	BankRegIn.close();
	system ("pause");
	return 0;
}


Another big help would be on creating a function which read the file (with the code used in case 2 of the switch(bankchoice)) and return an array called "names" that holds 4 strings.

Thanks in advance.
This is a school project and i need help on fixing this. I think the problem is with BankRegOut but i do not know why or how to fix it.

I think there must be something wrong with my telepathy. I've tried over and over again to read your mind to see what the problem is that you want us to fix, but I just can't seem to manage it.

I know it's a lot to ask, but do you think you could tell us what this mysterious problem is?
Gotta love your arrogance but yeah sorry, i forgot to point out the problem. The problem is, when i run case 1, it prints into the file and everything but when i run case 2, the file erases its content and no values are read from the file. Anything else i forgot?
ofstream BankRegOut ("bankreg.txt", ios::app);
Topic archived. No new replies allowed.