CJCoding With Joseph
15free / daySign inCreate account

A record holds fields separated by |, for example 9781|The Hobbit|3|12.50. Complete void printFields(const string& record) so it prints every field on its own line, in order, using find to locate each bar and substr to copy the text between them. A field may be empty (two bars in a row print an empty line), and a record with no bar at all is a single field.

The hidden driver reads one line and passes it to your function.

Do NOT write a main function.

Expected output

9781
The Hobbit
3
12.50

= newline. The output ends with a newline, so print one after the last line.

Hints4 available
Topics
Functions
Auto-input
9781|The Hobbit|3|12.50\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your output

Run your code to see the output here...

Test cases

Run your code to see test case results.