Basically I have used codeblocks to generate the functions/classes in my code i know what i want them to do but i cannot figure out how to manipulate the data i have
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
|
# include <iostream>
# include <fstream>
# define maxlength 5
# define max_acc 10
using namespace std;
class Account
{
public:
Account();
virtual ~Account();
int GetCustomer_ID() { return Customer_ID; }
void SetCustomer_ID(int val) { Customer_ID = val; }
int GetAccount_ID() { return Account_ID; }
void SetAccount_ID(int val) { Account_ID = val; }
char GetAccount_Type() { return Account_Type; }
void SetAccount_Type(char val) { Account_Type = val; }
double GetBalance() { return Balance; }
void SetBalance(double val) { Balance = val; }
double GetInterest_Rate() { return Interest_Rate; }
void SetInterest_Rate(double val) { Interest_Rate = val; }
protected:
private:
int Customer_ID;
int Account_ID;
char Account_Type;
double Balance;
double Interest_Rate;
}Accounts [max_acc];
class Customer
{
public:
Customer ();
~Customer ();
int GetCustomer_ID() { return Customer_ID; }
void SetCustomer_ID(int val) { Customer_ID = val; }
string GetCustomer_Name() { return Customer_Name; }
void SetCustomer_Name(string val) { Customer_Name = val; }
string GetAddress() { return Address; }
void SetAddress(string val) { Address = val; }
protected:
private:
int Customer_ID;
string Customer_Name;
string Address;
}Customers [maxlength];
int main ()
{
ifstream myfile ("customers.dat");
if (myfile.is_open())
{
while ( myfile.good() )
{ for (int n = 0; n <max_acc; n++)
{
myfile >> Customers[n]. SetCustomer_ID;
myfile >> Customers[n].SetCustomer_Name;
myfile >> Customers[n].SetAddress;
myfile >> Accounts[n].SetAccount_Type ;
myfile >> Accounts [n].SetAccount_ID;
}
myfile.close();}
|
this is to show the basis of what i am doing though i will need to add alot to this i know how to do the basic calculations etc.
Inside my Data there I am meant to input up until X then ignore X and process the next customer and accounts.
Simon Templar
63 Ninth Ave, Castlecrag
S
123456
0.00
X
Mata Hari
20 Wattle Ave, Doonside
K
937568
0.00
S
246890
0.00
C
917355
0.00
X
James Bond
C/- MI6, London
C
293567
0.00
X
Napolean Solo
Delflorios, New York City
S
337761
0.00
C
846579
0.00
X
There is a copy of the sample data Now Where X is i want to ignore that and Add the customer information to an Array or Linked List whichever is easier to implement
ie so that i can enter a customer number and view the associated accounts and account balances
with a loop which will simulate program exit when a varaible pin = 9999 so ie each customer should have the ability to choose any 4 digit number except for 9999 for their pin number or be able to type 9999 to exit i was thinking of using a switch statement on the Accounttype ie S,C,K etc including the balance operations while pin! = 9999 or allowing then to press a button ie X to exit
Which would make pin = 9999 so i know i need to declare that and remove a few of my functions as i have 1 extra Getter which is not necessary unless i can call specifically the Account information and the customer information separately.
Any Help on this is greatly Appriciated and my Apologies in advance for the length of my Post.