Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

// This is the implementation file for the method that prints the items in // a

ID: 3553633 • Letter: #

Question

// This is the implementation file for the method that prints the items in
// a list for a ListClass object.

#include "inlab6.h"
#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;

#include "structs.h"


// This function prints (iteratively) the contents of the list.
void ListClass::printList()
{
    NodePtrType ptr = head;

//    The following is the code necessary to print out the items
//    in the list.  Each node is printed on a line with the
//    account number then a tab then the balance.  To output a tab
//    character, use
//    cout << " "
//    Do not output any labels.  Just put the contents of the node.
//    For instance
//    1114    395.67
    
}

Explanation / Answer


// This function prints (iteratively) the contents of the list.
void ListClass::printList()
{
    NodePtrType ptr = head;

//    The following is the code necessary to print out the items
//    in the list.  Each node is printed on a line with the
//    account number then a tab then the balance.  To output a tab
//    character, use
//    cout << " "
//    Do not output any labels.  Just put the contents of the node.
//    For instance
//    1114    395.67
     while( ptr!= NULL)//while data to print
{
      cout<< "Account Num:"<<ptr->acctNum<<" Balance:"<<ptr->balance;
      ptr= ptr->next;
}
}