banking program error

hi, when I completed to case 4 and 5, l executed the program, actually functions working but exe file stops with an error.if you have any idea to solve it,it will be great, thanks.

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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

#include "transaction.h"
#include "account.h"
#include "Custome.h"
void trans(account* customer, const double& balance, const string& transactiondescription, const string& transactiondate);
int main()
{

	string customername, userid, pin;
	int option;
	account *acc;
	string transactiondate;
	string transactiondescription;
	double transactionamount;
	string customer;
	string accountno;
	double balance;
	double totaldeposit=0;
	double totalwitdrawal;
	transaction list[50];
	int transactioncount = 0;
	void recorddeposit();

	//main menu//
	do
	{

		cout << "Welcome to our banking system" << endl;
		cout << "*****************************************" << endl;
		cout << "Please chose your transaction" << endl;
		cout << "*****************************************" << endl;
		cout << "1-Create new customer record" << "\n"
			<< "2-Create new transaction" << "\n"
			<< "3-Create new account" << "\n"
			<< "4-Record deposit" << "\n"
			<< "5-Record withdraw" << "\n"
			<< "6-Print report" << endl
			<< "8-Exit" << endl;

		cin >> option;

		//transaction according to menu selection//
		switch (option)
		{
		case 1:
			cout << "please enter costumer name" << endl;
			cin >> customername;
			cout << "Please enter user id" << endl;
			cin >> userid;
			cout << "please enter pin number" << endl;
			cin >> pin;
			createcustomer(customername, userid, pin);

			break;
		case 2:
			cout << "enter transaction date" << endl;
			cin >> transactiondate;
			cout << "enter transaction amount" << endl;
			cin >> transactionamount;
			cout << "enter transaction description" << endl;
			cin >> transactiondescription;
			createtransaction(transactiondate, transactiondescription, transactionamount);


			break;

		case 3:
			cout << "please enter costumer name" << endl;
			cin >> customername;
			cout << "please enter the account number" << endl;
			cin >> accountno;
			cout << "enter transaction date" << endl;
			cin >> transactiondate;
			cout << "enter the amount of money you wanted to deposit" << endl;
			cin >> balance;
			transactiondescription = "Opening balance";
			acc = createaccount(customername, accountno, transactiondate, balance);
		
			cout << totaldeposit << endl;

			break;

		case 4:
			cout << "please enter costumer name" << endl;
			cin >> customer;
			cout << "enter the amount of money you wanted to deposit" << endl;
			cin >> balance;
			transactiondescription = "deposit";
			transactiondate = "01/01/2015";

			trans(acc, balance, transactiondescription, transactiondate);

			break;
		case 5:
			cout << "please enter costumer name" << endl;
			cin >> customer;
			cout << "enter the amount of money you wanted to withdraw" << endl;
			cin >> balance;
			transactiondescription = "withdraw";
			transactiondate = "01/01/2015";

			// trans(account*customer, balance, transactiondescription, transactiondate);





			break;

		case 6:
			//Display(createaccount);
			//int i;
			//for (int i = 0; i < customer->transactioncount; i++) DisplayUnit(customer>list[i]);
			//string vvv = "erer";

			//cout << vvv.customer<< endl;


			break;
		}//end switch
	} while (option != 8);

}
void trans(account* customer, const double& balance, const string& transactiondescription, const string& transactiondate)
{
	customer->list[customer->transactioncount] = *createtransaction(transactiondate, transactiondescription, balance);
	customer->transactioncount++;

}
*********************************************************************
header files
*********************************************************************
#include <iostream>
#include <iomanip>
#include <string>
#ifndef Custome_h
#define Custome_h
using namespace std;

#define EMPTY 0
#define BLANK ""

struct Custome
{
	
	string customername;
	string userid;
	string pin;
};

Custome* createcustomer(const string& customername = BLANK, const string& userid = BLANK, const string&pin = BLANK);
Custome*createcustomer(const string&customername, const string&userid, const string&pin)
{
	Custome* customer = new Custome();
	customer->customername = customername;
	customer->userid = userid;
	customer->pin = pin;
	cout << "customer is created" << endl;
	
	



	return 0;
}

#endif
****************************************************************
//account.h
#include <iostream>
#include <iomanip>
#include <string>
#include "transaction.h"
#include "Custome.h"
using namespace std;
string transactiondescription;

struct account
{
	string customer;
	string accountno;
	double balance;
	double totaldeposit;
	double totalwitdrawal;
	transaction list[50];
	int transactioncount=0;
};


account*createaccount(const string& customername, const string &accountno, const string &transactiondate,const double & balance);


account*createaccount(const string& customername, const string& accountno, const string&transactiondate, const double& balance)
{
	createtransaction(transactiondate, transactiondescription, balance);
	createcustomer(customername);
	
	return 0;
}

void Display(account*createaccount)
{
	for (int i = 0; i < createaccount->transactioncount; i++) display(createaccount->list[i]);



}
******************************************************************
//transaction.h
#include <iostream>
#include <iomanip>
#include <string>

#ifndef transaction_h
#define transaction_h
#define EMPTY 0
#define BLANK ""
#define DATE 01/01/2014

using namespace std;
struct transaction
{
	int transactioncount = 0;
	string transactiondate;
	string transactiondescription;
	double transactionamount;
};

transaction* createtransaction(const string& transactiondate=DATE, const string& transactiondescription=BLANK, const double& transactionamount=EMPTY);

transaction* createtransaction(const string& transactiondate, const string& transactiondescription, const double& transactionamount)
{
	transaction *createtransaction = new transaction();
	createtransaction->transactiondate = transactiondate;
	createtransaction->transactiondescription = transactiondescription;
	createtransaction->transactionamount = transactionamount;
	createtransaction->transactioncount++;
	cout << "transaction is created" << endl;
	return 0;

}

void display(transaction createtransaction)
{
	cout << createtransaction.transactiondescription << createtransaction.transactiondate;

}

#endif

I have not looked at all of it, but I think the current problem is that you have declared a pointer
account *acc;
and you are trying to do operations without first having it point to an actual account.
l am very confused about the reason, because when i executed it ,l took the error message after l took the "transaction is created " message and I reckon you might be right but l don't know how to fix it. I am quite new in C++ .
Sorry, I'm horrible at teaching so I don't think I can teach you about how pointers work. But I'm sure that someone else will come along soon and either explain them or link you to some material explaining them.

So in order to make this a useful post, some non-code related problems I want to point out:

1. You need to have a list or array of accounts or customers. This is evident from the existence of options 1 and 3 in your menu.
2. You need a search function. This is evident from the fact that you need a list or an array, and the existence of options 4 and 5 in your menu.
Topic archived. No new replies allowed.