I need help formatting some printed C-strings

I am doing an assignment for my Object-Oriented Programming class, in which there is a class called Book. Its member data are two char arrays, one called "title" with length 31, the other called "author" with length 21, an enum Genre called "type" with options FICTION, MYSTERY, SCIFI, COMPUTER and a double called "price."

I need to write a member function called "Display" that prints all of the member data out in one line as follows:

Title                              Author                   Genre          $Price          


I used setw to set the field width, but when I use left it only left justifies the first letter and the $ for price:

T                              itleA                   uthorGenre          $          Price


How can I left justify both entire arrays and the price with '$'?
Topic archived. No new replies allowed.