array problem

how would i display two different array with random numbers using these parameters
void displayArray(const int*, int);

and also how would i find the numbers that are equal in both arrays using
int * intersection(const int * const, int, const int* const, int, int &);
if anybody has any ideas that would be very helpful thanks

Comments

  • [b][red]This message was edited by AsmGuru62 at 2002-9-18 8:43:15[/red][/b][hr]
    : how would i display two different array with random numbers using these parameters
    : void displayArray(const int*, int);
    :
    : and also how would i find the numbers that are equal in both arrays using
    : int * intersection(const int * const, int, const int* const, int, int &);
    : if anybody has any ideas that would be very helpful thanks
    :
    [blue]You need three arrays actually, two parameters and a result array. Basically, here is an algorithm:

    1. Get the value from the first array
    2. Use [b]for()[/b] to scan the second array to find that value
    3. If value is found, store it into result array
    4. Repeat #1 until no more values is found in the first array

    Now, when you storing into result array you may want to make sure there is no duplicate items there, so check for that too.

    Basically, it will be two nested [b]for()[/b] statements. Three - if you decide to look for duplicates.[/blue]


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion