I am a C++ beginner, and recently my professor assigned a C++ homework that in my opinion, is hard to solve using C++. Below is the problem:
Problem Statement
Given a file, whose content is a table in which cells are separated by
a tab. For instance:
Full Name Age Gender
Cliff Chiang 9 B
Olivia Yang 8 G
For each line, split the line by a tab (For the above, the result is ["Cliff Chiang", 9, 8]
and ["Olivia Yang", 8, 6]
).
Associated questions
The first question doesn't really answer my question since my problem is to split a string by tabs, not a newline. Plus, there might be spaces in my table, which is not a question the problem above fully solved.
The second question converts in CSV format, not what mine is.
My question
- Is there any appreciated solution to this problem using C++?
- If not, is there a simple function that could do that? Thanks for your help.