For the final part of our project, we're supposed to:

Add the following constant (the file name must match exactly):
const string MASTER_FILE_NAME = "master.txt";


2. Create the file master.txt and add it to your project.
The master file must contain account records (one record per line).
Each account record contains the following fields, separated by spaces:
1. Account number, alphanumeric
2. First Name, string
3. Last Name, string
4. Account Balance, double
For example,

A111 Jayson Haxton 12345.81
A567 Amanda Noel 100893.77
B444 Thomas Huson 1.99
C565 Jonathan Odaniel -5.00
C890 Jeffrey Krabbe 500000.00

The BalanceFromFileFunction will read the master file and find the balance for given account.

How do I go about doing this? I created a text file with the example information in it, but how do I import this into the project?

Recommended Answers

All 3 Replies

<...snip...>

How do I go about doing this? I created a text file with the example information in it, but how do I import this into the project?

Use an input file stream ( ifstream myFile(MASTER_FILE_NAME); ) to read the information into your program and process it accordingly.

when i did that, it said: Error, cannot convert parameter 1 from 'const std::string' to 'const char *'

when i did that, it said: Error, cannot convert parameter 1 from 'const std::string' to 'const char *'

Make sure your parameters in your BalanceFromFile prototype and function head match.

Also, make sure you are using the right kind(s) of arguments when you call the function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.