Please use this template /************************************************************************* predefined classes, functions, structures *************************************************************************/ #include // cin, cout // missing several using namespace std; /************************************************************************* global formatting constants *************************************************************************/ const unsigned int AUTHOR_COLUMN_WIDTH = 25; const unsigned int TITLE_COUNT_COLUMN_WIDTH = 18; /************************************************************************* function prototypes *************************************************************************/ void showMenu(); void displayFirstFileLine(const string file_name); void displayFirstAuthorName(const string file_name); void displayFirstAuthorInformation(const string file_name); void displayAllAuthorInformation(const string file_name); void displayFormattedTableNoAverage(const string file_name); void displayEntireFormattedTable(const string file_name); /************************************************************************* main() definition *************************************************************************/ /************************************************************************* main() definition *************************************************************************/ int main() { // loop through menu unsigned int user_choice; const string FILE_NAME = "author_titles_data.txt"; // get first user choice showMenu(); cout << "Enter your choice [1 to 7]: "; cin >> user_choice; while (user_choice < 7) { cout << endl; switch (user_choice) { case 1: displayFirstFileLine(FILE_NAME); break; case 2: displayFirstAuthorName(FILE_NAME); break; case 3: displayFirstAuthorInformation(FILE_NAME); break; case 4: displayAllAuthorInformation(FILE_NAME); break; case 5: displayFormattedTableNoAverage(FILE_NAME); break; case 6: displayEntireFormattedTable(FILE_NAME); break; default: // nothing break; } cout << endl; // get next user choice showMenu(); cout << "Enter your choice [1 to 7]: "; cin >> user_choice; } cout << endl; return 0; } /************************************************************************* function definitions *************************************************************************/ void showMenu() { cout << "Choose an option:" << endl << "1) display the first file line unformatted to screen" << endl << "2) display the first author name to screen" << endl << "3) display the first author name, 3 spaces, title count to screen" << endl << "4) display all authors name, 3 spaces, title count to screen" << endl << "5) display formatted table of authors no average" << endl << "6) option 5 plus the formatted average titles per author" << endl << "7) quit" << endl << endl; return; } //************************************************************************* void displayFirstAuthorName(const string file_name) { return; } //************************************************************************* void displayFirstFileLine(const string file_name) { return; } //************************************************************************* void displayFirstAuthorInformation(const string file_name) { return; } //************************************************************************* void displayAllAuthorInformation(const string file_name) { return; } //************************************************************************* void displayFormattedTableNoAverage(const string file_name) { return; } //************************************************************************* void displayEntireFormattedTable(const string file_name) { return; } THis is the content of the file, author_titles_data.txt Jane Austen; 6 Charles Dickens; 20 Ernest Hemingway; 9 Jack Kerouac; 22 F. Scott Fitzgerald; 8 Mary Shelley; 7 Charlotte Bronte; 5 Mark Twain; 11 Agatha Christie; 73 Ian Fleming; 14 J.K. Rowling; 14 Stephen King; 54 Oscar Wilde; 1
Please use this template
/*************************************************************************
predefined classes, functions, structures
*************************************************************************/
#include <iostream> // cin, cout
// missing several
using namespace std;
/*************************************************************************
global formatting constants
*************************************************************************/
const unsigned int AUTHOR_COLUMN_WIDTH = 25;
const unsigned int TITLE_COUNT_COLUMN_WIDTH = 18;
/*************************************************************************
function prototypes
*************************************************************************/
void showMenu();
void displayFirstFileLine(const string file_name);
void displayFirstAuthorName(const string file_name);
void displayFirstAuthorInformation(const string file_name);
void displayAllAuthorInformation(const string file_name);
void displayFormattedTableNoAverage(const string file_name);
void displayEntireFormattedTable(const string file_name);
/*************************************************************************
main() definition
*************************************************************************/
/*************************************************************************
main() definition
*************************************************************************/
int main()
{
// loop through menu
unsigned int user_choice;
const string FILE_NAME = "author_titles_data.txt";
// get first user choice
showMenu();
cout << "Enter your choice [1 to 7]: ";
cin >> user_choice;
while (user_choice < 7)
{
cout << endl;
switch (user_choice)
{
case 1:
displayFirstFileLine(FILE_NAME);
break;
case 2:
displayFirstAuthorName(FILE_NAME);
break;
case 3:
displayFirstAuthorInformation(FILE_NAME);
break;
case 4:
displayAllAuthorInformation(FILE_NAME);
break;
case 5:
displayFormattedTableNoAverage(FILE_NAME);
break;
case 6:
displayEntireFormattedTable(FILE_NAME);
break;
default:
// nothing
break;
}
cout << endl;
// get next user choice
showMenu();
cout << "Enter your choice [1 to 7]: ";
cin >> user_choice;
}
cout << endl;
return 0;
}
/*************************************************************************
function definitions
*************************************************************************/
void showMenu()
{
cout << "Choose an option:" << endl
<< "1) display the first file line unformatted to screen" << endl
<< "2) display the first author name to screen" << endl
<< "3) display the first author name, 3 spaces, title count to screen" << endl
<< "4) display all authors name, 3 spaces, title count to screen" << endl
<< "5) display formatted table of authors no average" << endl
<< "6) option 5 plus the formatted average titles per author" << endl
<< "7) quit" << endl
<< endl;
return;
}
//*************************************************************************
void displayFirstAuthorName(const string file_name)
{
return;
}
//*************************************************************************
void displayFirstFileLine(const string file_name)
{
return;
}
//*************************************************************************
void displayFirstAuthorInformation(const string file_name)
{
return;
}
//*************************************************************************
void displayAllAuthorInformation(const string file_name)
{
return;
}
//*************************************************************************
void displayFormattedTableNoAverage(const string file_name)
{
return;
}
//*************************************************************************
void displayEntireFormattedTable(const string file_name)
{
return;
}
THis is the content of the file, author_titles_data.txt
Jane Austen; 6
Charles Dickens; 20
Ernest Hemingway; 9
Jack Kerouac; 22
F. Scott Fitzgerald; 8
Mary Shelley; 7
Charlotte Bronte; 5
Mark Twain; 11
Agatha Christie; 73
Ian Fleming; 14
J.K. Rowling; 14
Stephen King; 54
Oscar Wilde; 1
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images