Using Vectors with Class

So I just started working with Objects and am now transition from using arrays to vectors, and to be honest I am completely lost. I need to create a program that can read information from a file containing:

Last name, First name, initial
Street Address
State Zip code City
Account Number(6 digit integer) Balance

so I my class has this information:
Class Bank_Account
{
Private:
-string name, address, state;
-int zip_code;
-float balance;

Public:
+ bool Open_file(ifstream&,int);
+ int Read (ifstream&, vector<>&);
+ another function
+ another function
+ another function
}

my int main() has a vector declared as
vector <Bank_Account> record;
anyways for my reading function I formatted it like this:


int Read (ifstream&, vector<>&)
{
vector<Bank_Account> BA;
while (!fin.eof())
{
Bank_Account BA;
BA.getname();
BA.getaddress();
BA.getstate();
BA.getzip_code();
BA.getbalance();
record.push_back(BA);
}


now I'm sure this is all a horrible mess because I am so confused and have been trying to fix it but then as I read I think I am doing it wrong and switch things around...can someone jst give me a rough sketch of what goes where and why so I can use it as a guideline to fix my horrible mess here? Or let me know what I've done wrong. I feel as if I am walking in the dark here. Thanks :)
int Read (ifstream&, vector<>&)

The two parameters of your function do not have a name.
Therefore you cannot access your parameters inside your function.

Also your "class information" looks like a sketch not valid C++ code.
Master the basics then try again... http://www.cplusplus.com/doc/tutorial/

Topic archived. No new replies allowed.