// Supplementary to "Software Design ...", John A Robinson, Newnes, 2004, // Test program for medianfilter class, created Thu Aug 28 12:42:56 2003 #include "medianfilter.h" #include using namespace std; int main(int argc, char *argv[]) { int filterlengh; int inputlength; double val; cout << "Enter filter length: "; cin >> filterlengh; cout << "Enter input length (number of iterations): "; cin >> inputlength; medianfilter testmedianfilter(filterlengh); // cout << "Buffer state:\n"; // testmedianfilter.print(); for (int i = 0; i < inputlength; i++) { cout << "Next input value: "; cin >> val; val = testmedianfilter.addnext(val); cout << "Value displaced was " << val << endl; val = testmedianfilter.getmedian(); cout << "Current median is " << val << endl; // cout << "Buffer state:\n"; // testmedianfilter.print(); } return 0; }