I have added the customer and account class header files to the main topic.
I have not applied any checks for the validity of the variables at the moment, however i am using a set list of numbers i know will work so i can make sure everything else works before i add checks etc.
I added a cout and it is recieving the correct values.
I am very new to coding, and wasn't aware how intense the first year of university would focus on it so I am unsure of many aspects of it, how would i make it part of the customer class?
Thanks.
Update: I *believe* I have successfully made the withdrawal function a member of my customer class, however now within the switch I use to call variables I get the following error:
'Customer::Withdrawal': non-standard syntax; use '&' to create a pointer to member
I will paste update the code for customer.h and customer.cpp to show the function and how it is being defined.
This is the switch case which contains the error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
void chooseAction(Customer custID[], int chosenCustInt) {
int custAction;
cin >> custAction;
switch (custAction) {
case 1: custID[chosenCustInt].Withdrawal; break;
case 2: Deposit(custID, chosenCustInt); break;
case 3: DisplayBalance(custID, chosenCustInt); break;
case 4: CalcInterest(custID, chosenCustInt); break;
case 5: CreateLoan(custID, chosenCustInt); break;
case 6: QuickWithdrawal(custID, chosenCustInt); break;
case 7: CreateOverdraft(custID, chosenCustInt); break;
case 8: MakeAcc(custID, chosenCustInt); break;
}
}
|
The error occurs on line 5. ( I am yet to change the other functions to be directly within customer class, but i would rather focus on getting at least one working first)
Update 2: Fixed that, forgot i needed to add the parameters. However I have now tested it like that and it still fails to work, simply crashing the program.