Think about it. The number 1, the text "ftest", the text "ltest", and the value $10 all share one property; and the number 2, the text "ftest2", the text "ltest2", and the value $20 all share a different, similar property. So you need to write the code that can read in the text
1 2 3 4 5 6 7
|
Your account number: 1
Your First Name: ftest
Your Last Name: ltest
Your current balance: $10
| |
and from this assemble a single object that contains the number 1, those two strings, and the value $10. For example, the class for that object might be
1 2 3 4 5 6
|
class Account{
int number;
std::string first_name;
std::string last_name;
double balance;
}
| |
Once you have that, you need to read all the accounts in the file. And once you have that array of accounts loaded in memory, you can perform queries with it, such as get the balance for account 2.
PS: You might want to use a different format for your file. The way you've defined it you're making your problem much more difficult than it needs to be. I would start with something simpler:
1 2 3 4 5 6 7 8
|
1
ftest
ltest
10
2
ftest2
ltest2
20
| |