> I am having a very hard time getting my getCustomer() function to work. It's
> supposed to loop over an array and determine if there is a matching
> customerID value.
you tell us what you want to do, but not the problem that you're having.
¿what's wrong with your implementation? (compile error/crash/wrong value)
> I've included all code in case there is a problem elsewhere
no, you haven't included
all your code.
you copy-pasted random snips that you think are relevant. we can't even compile that.
if you knew what's relevant to your problem, you probably would have solve it already.
so paste
all your code.
if you've got several files, upload to github or similar.
> As of now, the error says I need to create a pointer using & in the .getCustomerId line
you don't understand the error, no problem. some messages are confusing, or you may lack the knowledge. again, no problem.
but don't go paraphrasing it then.
1 2 3 4 5 6
|
//Customer customers[5];
const int MAX = 6;
string error = "Error: ID not found";
for (a; a != MAX; ++a) {
if (customers[a].getCustID == customerId) {
|
out of bounds
1 2 3
|
Customer c = cust[a];
if (a <= size) {
cust[a] = c;
|
¿what? ¿what was your intention there?
you are assigning A to B, and then in some cases write it back to A.
also, ¿where does cust[a] came from? and you don't do anything with all those variables that you read from the file