Question: Using C++ How do I print this unsorted list code to a file called outfile1.txt? //---------------------------------------- // PrintList // Non-member function to print list of

Using C++

How do I print this unsorted list code to a file called outfile1.txt?

//----------------------------------------

// PrintList

// Non-member function to print list of items

//----------------------------------------

else if (command == "PrintList")

{

cout << " These are the List values" << endl;

outFile << " These are the List values" << endl;

PrintList(list);

}

// Or how do I use this code to print the unsorted list to a file called outfile.txt?

void PrintList(UnsortedType &list)

{

int length;

ItemType item;

ItemType data;

list.ResetList();

length = list.GetLength();

for (int counter = 1; counter <= length; counter++)

{

item = list.GetNextItem();

item.Print();

cout << endl;

}

cout << "Length of list = " << length << endl << endl;

}

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 Databases Questions!