I am trying to get the values in my array to print to the screen. When I do the step in debugging it looks like the values are going into the array okay. How do I print each item of the array to the screen? Below is my code. Thank you for your help.
//******************************************************************
// IMPLEMENTATION FILE (list.cpp)
// This file implements the List class member functions
// List representation: a one-dimensional array and a length
// variable
//******************************************************************
#include "list.h"
#include <iostream>
#include <fstream>
using namespace std;
ifstream inData; //File of values.
List value; //List of values from file.
int item; //One value read.
// Private members of class:
// int length; Length of the list
// ItemType data[MAX_LENGTH]; Array holding the list items
int main()
{
inData.open("int.dat");
if( !inData)
{
cout << "Could not open int.dat file." << endl;
return 1;
}
value.Store(item);
// Precondition:
// length > 0
// && item is assigned
// Postcondition:
// IF item is in data array at entry
// First occurrence of item is no longer in array
// && length == length@entry - 1
// ELSE
// length and data array are unchanged
{
int index = 0; // Index variable
while (index < length && item != data[index])
index++;
ItemType List::GetNextItem()
// Precondition:
// No transformers have been invoked since last call
// Postcondition:
// Returns item at the currentPos@entry in the list and
// resets current to next position or first position if
// last item is returned
{
ItemType item;
item = data[currentPos];
if (currentPos == length - 1)
currentPos = 0;
else
currentPos++;
return item;
}
// Postcondition:
// data array contains the same values as data@entry, rearranged
// into ascending order
{
ItemType temp; // Temporary variable
int passCount; // Loop control variable
int searchIndx; // Loop control variable
int minIndx; // Index of minimum so far