Question: need help with extracting data from file and storing them into new arrays. this is the data.txt file as an example: [1, 1]-3-Hello [1, 2]-3-Hello

need help with extracting data from file and storing them into "new" arrays.

this is the data.txt file as an example:

[1, 1]-3-Hello [1, 2]-3-Hello [1, 3]-3-Hello [2, 1]-3-Hello [2, 2]-3-Hello [2, 3]-3-Hello

the "-" is the delimiter.

each line contains the following sequence: 2 numbers stored in a bracket, followed by the delimiter, then a number, followed by the delimiter again, and then a word.

the contents in the data are not fixed. do not assume the total number of lines of data.

i have to extract the following into separate arrays:

1. the numbers inside the brackets. e.g [1, 1] from the first line

2. the number in-between the delimiters. e.g "3" from "-3-", but only extract 3

3. the word for every line. e.g each line contains "Hello"

so a sample i am looking for is like this :

1. array 1 stores [1, 1], [1, 2] and so on.

2. array 2 stores 3,3,3 and so on.

3. array 3 stores Hello, Hello, Hello and so on.

do not create your own functions for this, this is a procedural programming.

use c++ only.

the arrays can be of any type: string, int, double, struct, etc.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!