Use c.arse(p) to delete the middle number

Hi everyone
I was asked ti define integer list, and ask the user to enter at least 5 numbers. Then, use the c.erase(p) to delete the middle number and display the rest of the element.

Here is my attempt:

#include <iostream>
#include <list>
using namespace std;

int main ()
{

cout<<"Enter at least five integer Numbers" <<endl;
mylist<int> input_numbers;
unsigned int i;
list<unsigned int> mylist;

for (i=1; i<=5; i++) mylist.push_back(i);

mylist.erase (mylist.size()/2);

cout << "mylist contains:";
for (i=0; i<mylist.size(); i++)
cout << " " << mylist[i];
cout << endl;

return 0;
}

Thank you
closed account (3hM2Nwbp)
The first thing that pops into my mind is that the data type mylist isn't declared anywhere. Apart from that, I'm not a compiler, so if you need more specific information you'll have to post what the actual error is.
Last edited on
Topic archived. No new replies allowed.