Need assignment help

Hi All I need help with the following program for an assignment. It was already posted but didn't have the complete program. If anyone can give me the full program it is highly appreciated.

Please write a program to use vector and list to store 10 integers in order (from smallest to largest). You need to find proper location using vector or list functions for each number added. Please do NOT use any sorting function.
a. Generate 1 random integer between -100 and 100 and display it on screen
b. Insert the number generated in step b into Vector and List
c. Display the contents of Vector and List after adding a number
d. Use loop structure to repeat step a-c 10 times.
For example, the output screen may display as following:
Number generated: 23
Vector: 23
List: 23
Number generated: -15
Vector: -15, 23
List: -15, 23
Number generated: 40
Vector: -15, 23, 40
List: -15, 23, 40
Number generated: -6
Vector: -15, -6, 23, 40
List: 15, -6, 23, 40
etc
> If anyone can give me the full program it is highly appreciated.

Here is the full program
(submit this only after you have understood it; you may be required to explain how it works):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
#include <random>
#include <cstdint>
#include <vector>
#include <list>
#include <algorithm>

int random_integer( int minv = -100, int maxv = +100 )
{
    // http://en.cppreference.com/w/cpp/numeric/random/random_device
    static std::mt19937 rng( std::random_device{}() ) ;
    
    // http://en.cppreference.com/w/cpp/numeric/random
    return std::uniform_int_distribution<int>{ minv, maxv }(rng) ;
}

// http://en.cppreference.com/w/cpp/algorithm/upper_bound
template < typename SEQ_CNTR, typename T > auto ubound( const SEQ_CNTR& seq, const T& value )
{ return std::upper_bound( std::begin(seq), std::end(seq), value ) ; }

// http://en.cppreference.com/w/cpp/container/vector/insert overload (1)
// http://en.cppreference.com/w/cpp/container/list/insert overload (1)
template < typename SEQ_CNTR, typename T > SEQ_CNTR& insert_ordered( SEQ_CNTR& seq, const T& value )
{ seq.insert( ubound(seq,value), value ) ; return seq ; }

template < typename SEQ_CNTR > void print( const SEQ_CNTR& seq, std::ostream& stm = std::cout )
{
    stm << "[ " ;
    // http://www.stroustrup.com/C++11FAQ.html#for
    for( const auto& v : seq ) stm << v << ' ' ;
    stm << "]\n" ;
}

template < typename SEQ_CNTR, typename T >
void insert_ordered_and_print( SEQ_CNTR& seq, const T& value, const char* name = "", std::ostream& stm = std::cout )
{ print( insert_ordered( seq, value ), stm << name << ": " ) ; }

// https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html#Stringizing
#define INSERT_ORDERED_AND_PRINT( seq, value ) insert_ordered_and_print( seq, value, #seq )

int main()
{
    std::vector<int> vec ;
    std::list<int> lst ;

    // Use loop structure to repeat step a-c 10 times.
    for( int i = 0 ; i < 10 ; ++i )
    {
        // a. Generate 1 random integer between -100 and 100 and display it on screen
        const int number = random_integer() ;
        std::cout << "\nnumber generated: " << number << '\n' ;

        // b. Insert the number generated in step a into Vector and List
        // c. Display the contents of Vector and List after adding a number
        INSERT_ORDERED_AND_PRINT( vec, number ) ;
        INSERT_ORDERED_AND_PRINT( lst, number ) ;
    }
}

http://coliru.stacked-crooked.com/a/75ac25d809039cfa
http://rextester.com/SHRHPL13388
Topic archived. No new replies allowed.