Question: C++ how do you make a custom parsing from one type of format to another type of format? For example, how would you take a
C++ how do you make a custom parsing from one type of format to another type of format? For example, how would you take a proprietary list of numbers from the STDIN stream and have it write out to the STDOUT stream in a JSON format for C++ by ONLY using a single .cc file? All of this must be completed in one file using for loops. No arrays/vectors preferably.
For example, lets say we have the following format.
num_of_people
ID_num
num_of_scores
score_1
score_2
score_n
I want to read in each of the number_of_people and write down their ID and how many scores and what their scores were and have them printed out.
Let's say we have this data number set separated by spaces:
3 10 2 50 50 11 3 50 60 55
and we want to parse those values to be in JSON form as the following:
3 = number of people
10 = person one ID number
2 = number of scores
50, 50 = both two of their scores
11 = person two ID number
3 = number of scores
50,60,55 = their three scores
How would I get that data set read specifically by using a for loop within a for loop to print out and read as described from that number data set?
I mostly just need to understand how to declare this data set and how to read it into a for loop so I may be able to read and determine what each value means from that line of numbers.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
