Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,271 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,448 people online right now. Registration is fast and FREE... Join Now!




insertion

 
Reply to this topicStart new topic

insertion

sknox1
7 Nov, 2006 - 05:26 AM
Post #1

New D.I.C Head
Group Icon

Joined: 30 Sep, 2006
Posts: 29


Dream Kudos: 150
My Contributions
CODE

#include <cstdlib>
#include <iostream>
#include "d_random.h"
#include <list>
#include"d_listl.h"
#include "d_util.h"


using namespace std;


template <typename T>
void insertOrder(list<T>& orderedList, const T& item);


int main()

{
    
    int a[]={15,92,42,73,83,65,38,29,10,6};
    int sizeA= sizeof(a)/sizeof(int);
    int b[]={6,10,15,29,38,42,65,73,83,92};
    int sizeB= sizeof(B)/sizeof(int);
    
    int n;
    int random_integer = rand();

    list<int>list1(a, a+sizeA), list2(b, b+sizeB);

for(int i=0; i<10; i++)
{
    n = rand()%100;
    
    insertOrder(list1 ,n);
    writeList(list1);
        cout<<endl;
}



return 0;
}



how can i insert my raandom numbers into my list1, without getting a tree effect for my results?

EDIT : Tags Added - b2c
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 07:57PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month