### Homework Help

This is my final homework assignment. I've been looking over these errors but I need some help. Is anyone out there?

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164`` `````` #include #include #include using namespace std; template class mlist { public: mlist();//creates the list T front();//returns the front of the list T end();//returns the end of the list and moves every entry up one position; bool in(T x);//returns true if x is in the list and false otherwise bool empty(); // returns true if the list is empty void addfront(T entry);//add entry to the back of the list void addend(T entry);//add entry to the back of the list void addorder(T entry);//add entry to an ordered list void removefront();//removes the front of the list void removeend();//removes the back of the list void remove(T n);//searches the list and removes the entry with value n private: vector mlist; void remove(typename vector::iterator ix, T n);//uses an iterator and recursion to remove value n void addorder(typename vector::iterator ix, T n);//uses an iterator and recursion to add value n in an ordered list }; // mlist template mlist :: mlist(){} template mlist :: front() { return *mlist.begin(); } template mlist :: end() { return(*--mlist.end()); } template bool mlist in (Tx) { for(int i = 0; i in (Tx) { typename vector :: iterator it; for (it = mlist.begin; it! = mlist.end(); it++) { if (* it == x) { return true; } } return false; } template bool mlist empty() { if (mlist.size() == 0) { return true; } else { return false; } } template void mlist addfront (T entry) { mlist.insert (mlist.begin(), entry); } template void mlist :: addend (T entry) { mlist.push_back(entry); } template void mlist :: remove front() { mlist.erase (mlist.begin()); } template void mlist :: remove end() { mlist.erase (--mlist.end()); } template void mlist :: remove (Tn) { remove (mlist.begin(), n); } template void mlist :: remove (typename vector :: iterator ix, Tn) { if (ix == mlist.end()) { return; } if (*ix == n) { mlist.erase (ix); return; } remove (++ ix, n); } template void mlist :: addorder (T entry) { addorder (mlist.begin(), entry) } { if (ix == mlist.end()) { mlist.insert(ix, n); return; } if (n <= *ix) { mlist.insert(ix, n); return; } addorder(++ix, n); } int main() { mlist test1=mlist() ; test1.add(5); test1.add(7); test1.add(4); test1.remove(7); cout << test1.front()<< endl; cout << test1.back()<< endl; mlist test2= mlist() ; test2.add("John"); test2.add("Paul"); test2.add("Mary"); test2.add("Kate"); test2.remove("Paul"); cout << test2.front()<< endl; cout << test2.back()<< endl; }``````

|32|error: need 'typename' before 'mlist<T>::T' because 'mlist<T>' is a dependent scope|

|38|error: need 'typename' before 'mlist<T>::T' because 'mlist<T>' is a dependent scope|

|44|error: invalid declarator before 'in'|

|56|error: 'T' was not declared in this scope|

|56|error: template argument 1 is invalid|
 ``12345678`` ``````template /*¿return type?*/ mlist :: front() { return *mlist.begin(); } bool mlist in (Tx) //¿ah? ``````

Topic archived. No new replies allowed.