Im a beginner at c++ and i have no idea of what im suppose to do

Write an interactive program that allows a user you update am ordered list of numbers. You may use your own list of numbers. You should input an ordered list of numbers and display the list. You should input a mew number which increases the list by one and display the updated list.

Something like:
1. Put some numbers into a list
2. Show the list
3. Get a number from the user
4. Insert the number into the list
5. Show the list

The list should be a container of numbers that supports the necessary operations.
See http://www.cplusplus.com/reference/stl/
std::list and std::vector are plausible.

When putting/inserting a number, you have to do it at the correct spot.
In other words, you have first find the correct position for the insertion.

"Correct" as in "a list that is ordered before insertion is ordered after insertion too".
#include <iostream>
#include <list>
#include <vector>

int main ()
{
std::list<int> mylist;
std::list<int>::iterator it;

// set some initial values:
for (int i=1; i<=5; ++i) mylist.push_back(i); // 1 2 3 4 5^
std::cout << "mylist contains:";
for (it=mylist.begin(); it!=mylist.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
{
std::cout << "Enter list of numbers" << ;
}
cin >> list<int>
I think that im doing but errors are coming up but I don't know what I need to fix
Topic archived. No new replies allowed.