Hey, I am having some problems with this program that was given to me. I was given the main program and had to create a list class to use the fxns called in the main program. Well, I am having some problems with the functions themselves (what to put in them). Oh, the data manipulated is in an array without using pointers. I have included the main program
here is the code for the header:
thanksCode:#include <iostream> using namespace std; class List { public: typedef int value_type; static const value_type CAP=30; value_type mylist[CAP]; List(); List(List& x); //void destroy(); //void assign(); void remove(); //destroy operation void first(); //first operation void next(); //next operation void prev(); //previous operation void Makecurrent(); //makecurrent operation value_type examine(); //examine operation void replace(value_type v); //replace operation value_type insertafter(value_type v); //insert after operation value_type insertbefore(value_type v); //insert before operation value_type size(); //Count operation friend ostream & operator<<(ostream& out, List x) { return out << x; } private: int pos; int used; }; List::List() { pos=0; used=0; } List::List(List& x) { pos=x.pos; used=x.used; } void List::remove() { } void List::first() { pos=mylist[0]; } void List::next() { if(pos<used) pos++; } void List::prev() { if(pos>used) {pos--;} pos--; } List::Makecurrent() { } value_type List::examine() { return pos; } void List::replace(value_type v) { } value_type List::insertafter(value_type v) { if(used>CAP) return 0; for(int i=used;i>pos;i--) mylist[i+1]=mylist[i]; pos++; mylist[pos+1]=v; used++; return 1; } value_type List::insertbefore(value_type v) { if(used==0) return 0; //for(int i=) } value_type List::size() { return used; }



LinkBack URL
About LinkBacks


