Build a Book From a Pipe-Delimited Record
mediumQuestion 722Complete the constructor Book(const string& record). The record always has the shape ISBN|TITLE|COPIES|PRICE, but any token may carry extra spaces around it: 9781 | The Hobbit |3| 12.5 must produce isbn 9781, title The Hobbit (inner spaces kept), 3 copies and price 12.5. Use find to locate the three bars, substr to cut each token out, the provided trim helper to strip the spaces, then stoi for the two whole numbers and stod for the price.
The getters are already written. The hidden driver reads one record per line, builds a Book from each and prints the isbn, the title in square brackets, the copies and the price with two decimals, separated by single spaces.
Do NOT write a main function.
Expected output
9781 [The Hobbit] 3 12.50 42 [Dune] 10 8.00
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...