// This is the implementation file for the method that prints the items in // a
ID: 3553656 • 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
while(ptr != NULL) {
RecordType data = ptr->data;
int acctNum = data.acctNum;
float balance = data.balance;
cout << acctNum << " " << balance << " ";
ptr = ptr->next;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.