Question
I need help in C++ please #include #include #include //FIXME: stream manipulation library using namespace std; int main() { // Variables ofstream outFS; ifstream inFS;
I need help in C++ please
#include
//FIXME: stream manipulation library
using namespace std;
int main() { // Variables ofstream outFS; ifstream inFS; string dataTitle; string columnHeader1; string columnHeader2; string authorName; int numNovels; //get title for data /* Type code here. */ //get and output the column headers /* Type code here. */ //get and output the column headers /* Type code here. */ //open outFS and put the user data into the file outFS.open("novels.txt"); cout > numNovels; // number of novels cin.ignore(); // skip over one character, space getline(cin, authorName); // get the rest of the line, author's full name while (numNovels != -1 && authorName != "done") { // to stop enter -1 done // display data to screen cout > numNovels; cin.ignore(); getline(cin, authorName); } outFS.close(); cout (1) Prompt the user for a title for data. Output the title. Ex: Enter a title for the data: Number of Novels Authored You entered: Number of Novels Authored (2) Prompt the user for the headers of two columns of a table. Output the column headers. Ex: Enter the column 1 header: Author name You entered: Author name Enter the column 2 header: Number of novels You entered: Number of novels (3) Open an output file named "novels.txt". Prompt the user for data points. Data points must be in this format: int string. The user will enter -1 done when they have finished entering data points. Output the data points. Write the data points to an output file. Assume the user enters valid input. Note: this part of the program has already been written and tested Review the code. Ex: Enter a data point (-1 done to stop input): 6 Jane Austen Data string: Jane Austen Data integer: 6 (4) Close the output file. (5) Open an input file named novels.txt. Now you are using the same file but this time you are reading data from the file and output the information in a formatted table. The title is right justified with a setw() value of 33. Column 1 has a setw() value of 20. Column 2 has a setw() value of 23 Ex Number of Novels Authored Author name Number of novels 6 20 9 Jane Austen Charles Dickens Ernest Hemingway Jack Kerouac F. Scott Fitzgerald | Mary Shelley Charlotte Bronte Mark Twain Agatha Christie Ian Flemming J.K. Rowling Stephen King Oscar Wilde 22 8 7 5 11 73 14 14 54 1 (6) Close the input file. (7) Open the input file named novels.txt again. Now you are reading data from the file and output the information as a formatted histogram (display a line of asterisks to match the number of novels written by each author). Each name is right justified with a setw() value of 20. (8) Close the input file. Ex: Jane Austen ****** Charles Dickens Ernest Hemingway Jack Kerouac F. Scott Fitzgerald Mary Shelley Charlotte Bronte Mark Twain Agatha Christie Ian Flemming J.K. Rowling Stephen King Oscar Wilde * 293630.1722736
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started