Question: Needs to be in C++. I have completed the listlinked cpp but I need help with the slideshow cpp. The slideshow cpp needs to be

Needs to be in C++. I have completed the listlinked cpp but I need help with the slideshow cpp. The slideshow cpp needs to be implemented on the slideshow.cpp.

slideshow.cpp

// Displays a slide show.

// Uncomment the following line if running in windows // #define WIN32

#include #include #include

using namespace std;

#include "ListLinked.cpp"

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

// This is a very ugly way to wait for a specified amount of time. // It is ugly because it runs the CPU the whole time, instead of // just suspending the process for the required time period. // However, it is also very portable. This function should work on // all platforms that support ANSI C++. Feel free to replace this // with something nicer (such as sleep or usleep) if you so choose. void wait(int secs) { int start=clock();

while (clock() < start + secs * CLOCKS_PER_SEC); }

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

class Slide { public: static const int HEIGHT = 10, // Slide dimensions WIDTH = 36;

void display () const; // Display slide and pause

private:

char image [HEIGHT][WIDTH]; // Slide image int pause; // Seconds to pause after // displaying slide

friend istream& operator>> (istream& in, Slide& slide); friend ostream& operator<< (ostream& out, const Slide& slide); };

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

int main () { List slideShow; // Slide show slideShow.showStructure(); Slide currSlide; // Slide char filename[81]; // Name of slide show file

// Read the slide show from the specified file.

cout << endl << "Enter the name of the slide show file : "; cin >> filename;

ifstream slideFile ( filename );

if ( !slideFile ) { cout << "Error opening file " << filename << endl; } else { // Read in the slides one-by-one. (Your code below)

// Close the file. (Your code below)

// Display the slide show slide-by-slide. (Your code below)

}

return 0; }

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

istream& operator>> (istream& inFile, Slide& slide)

// Read a slide from inFile.

{ // Read a slide from inFile. (Your code below)

return inFile; }

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

ostream& operator<< (ostream& out, const Slide& slide)

{ // Display a slide. (Your code below)

return out; }

void Slide:: display () const

{ //This should compile and run on both Windows and Unix //Feel free to change this if you want to do something nicer. #ifdef WIN32 system("cls"); #else system("clear"); #endif

// Display a slide and pause. (Your code below)

}

listlinked.cpp

#include "ListLinked.h"

// ListNode member functions

template List::ListNode::ListNode(const DataType& nodeData, ListNode* nextPtr) { this->dataItem = nodeData; this->next = nextPtr; }

// List member functions

template List::List(int ignored) { head = 0; cursor = 0; }

template List::List(const List& other) { ListNode* copy = other.head; while (copy != NULL) { this->dataItem = copy->dataItem; this->next = copy->next; gotoNext(); copy = copy->next; } *this = other; }

template List& List::operator=(const List& other) { ListNode* copy = other.head; while (copy != NULL) { insert(copy->dataItem); gotoNext(); copy = copy->next; } return *this; }

template List::~List() { clear(); }

template void List::insert(const DataType& newDataItem) throw (logic_error) { if (isEmpty()) { head = new ListNode(newDataItem, 0); cursor = head;

} else { cursor->next = new ListNode(newDataItem, cursor->next); cursor = cursor->next; }

}

template void List::remove() throw (logic_error) { ListNode* Node; if (isEmpty()) { cout << "Cannot remove from empty list." << endl; } else if (cursor == head) { Node = head; head = head->next; gotoNext(); delete Node; } else { ListNode* previous; Node = cursor; previous = head; while (previous->next != cursor) { previous = previous->next; } if (cursor->next != NULL) cursor = cursor->next; else cursor = head; previous->next = Node->next; delete Node; Node = NULL; }

}

template void List::replace(const DataType& newDataItem) throw (logic_error) { if (isEmpty()) throw logic_error("list is empty."); if (head != NULL) cursor->dataItem = newDataItem; }

template void List::clear() { if (isEmpty()) { cout << "List is already empty!" << endl; } else { cursor = head; ListNode* Node; while (cursor != NULL) { Node = head; head = head->next; cursor = cursor->next; delete Node; } head = NULL; cursor = NULL; }

}

template bool List::isEmpty() const { return head == 0; //return false; }

template bool List::isFull() const { return false; }

template void List::gotoBeginning() throw (logic_error) { cursor = head; }

template void List::gotoEnd() throw (logic_error) { while (cursor->next != NULL) { cursor = cursor->next; } }

template bool List::gotoNext() throw (logic_error) { if (cursor->next != NULL) { cursor = cursor->next; return true; } else return false; }

template bool List::gotoPrior() throw (logic_error) { if (cursor != head && head != NULL) { ListNode* findPrior = head; while (findPrior->next != cursor) findPrior = findPrior->next; cursor = findPrior; return true; } else return false; }

template DataType List::getCursor() const throw (logic_error) { if (!isEmpty()) { return cursor->dataItem; } else { throw logic_error("List is empty."); } //DataType t = NULL; //return t; }

template void List::moveToBeginning() throw (logic_error) { if (cursor != head && head != NULL) { ListNode* findPrior = head; while (findPrior->next != cursor) { findPrior = findPrior->next; } findPrior->next = cursor->next; cursor->next = head; head = cursor; } }

template void List::insertBefore(const DataType& newDataItem) throw (logic_error) { if (isEmpty()) { head = new ListNode(newDataItem, 0); cursor = head; } else { if (cursor == head) { ListNode* node = new ListNode(newDataItem, head); head = node; cursor = node; } else { gotoPrior(); insert(newDataItem); } } }

#include "show5.cpp"

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!