MergeTest - #include #include #include #include...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <cstdlib> #include <iostream> #include <fstream> #include <list> using namespace std; void merge(list<int>&, const list&); // utility class class Reader { public: void setInputStream(istream* is) { isr = is; } void setLineLimit(int limit) { lineLimit = limit; } list<int>* buildList() { list<int>* data = new list<int>(); throw 0; } cout << "Enter a list. ..\n"; int value; int last=-1; (*isr) >> value; while (true) { lineCount++; if ((*isr).eof()) { // must be EOF // switch from file to cin isr = &cin; continue; } else { cout << "Unexpected end of input reached.\n"; throw 0; } } if (!(*isr)) { // non-numeric input (*isr).clear(); (*isr).ignore(numeric_limits<streamsize>::max(),'\n'); cout << "error on input line " << lineCount << ". Non-numeric data ignored.\n"; } else if (value<0 || value > 999) { if (value==-1) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
eof = true; break; } if (value==1000)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

MergeTest - #include #include #include #include...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online