Question: #include #include #include using namespace std; / / * * complete readNames here to read in hw 1 input.txt into the matrix 3 x 4

#include
#include
#include
using namespace std;
//** complete readNames here to read in hw1input.txt into the matrix 3x4
// Purpose of the function: **
// Parameters are for: a 3x4 string matrix and the input stream to use
void readNames(string N[3][4],**)
{
//** note that you need to use a while loop because you do not know
// how many lines are in the file, but you may assume that no bad row or column
// numbers will be given
}// end of readNames
//** complete displayNames here to display what is in the matrix 3x4
// make sure it looks nice like a table
// Purpose of the function: **
// Parameter are for: a 3x4 string matrix
void displayNames(string N[3][4])
{
}//end of displayNames
//Create a search function that will allow you to look for a user inputted name
inside the matrix and output the indices of where it was located or or the message
"name was not found"
//ask for the name in the main and pass to the function
//Purpose of the function: **
//Parameters are for: **
** search(**)
{
}//end of search
//create a function that will find the longest name in the matrix
//in cases where there are multiple names with the same longest length, you only
have to show the first one witht he longest length.
// Purpose of the function: **
// Parameter are for:**
** findLongestName(**)
{
}//end of findLongestName
// The driver
int main()
{
string Names[3][4]; // matrix of names
//** here initialize all slots as blank strings
string fname; // the input file name
cout "Enter the input file name: ";
cin >> fname;
//** here create the stream fin to the file and open it
readNames(Names, fin); // reads
displayNames(Names); // displays
}// end of main
1. Initialize the Names matrix with blank strings.
2. Get the filename from the user and send the stream to the readNames function.
3. Each line of the input file says the row and column first before the name. Rows are
always given as a,b,c and columns are always given as a,b,c,d. You do
not know how many lines are in the input file.
4. Make sure the matrix is displayed nicely like a table.
5. Create the function search. Call search twice in the main, one with a name from the
file and one without. Your function should work for both.
6. Create a function called findLongestName and have it display the longest name in the input file provided (the screenshot)
a a Mary
a c John
b a Kathy
b b Steve
c b Sue
c d David
#include #include #include using namespace std; /

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!