Input from a file into an array?

Hello, I just have a quick question regarding functions, arrays, and reading from a file.

So I'm wanting to create a function which takes input from a file (strings and integers -- the person's name and their current salary (float)) and store said data into two arrays.

I want the arrays to be similar so if I look up the same element in the array it would match up.

From an input file:
i.e. Billy = array[0]
$62753.89
Jill = array[1]
$250,000.00

If that doesn't make sense I can attempt to clarify better. Just basically taking input from a file, storing it in an array which is used in a function.

I tried it myself and when I cerr my function it comes out to equal 1.
Whats the input file look like?

Can you show what you have?
Last edited on
The input would look exactly like this:


Steve S.
2000.00
John T.
3452.15
Sarah K.
4999.32
Ameno A.
3798.27

I would need to take the name out, store that in an array, then take out the salary, store that in an array, and make them parallel with one index.
Bump if it's allowed, still needing help
Topic archived. No new replies allowed.