Need help with my array program

Add a program that declares two arrays of 5 integers each. Provide one function to load one array with random numbers from 1 to 25, another to fill the other array with user supplied values, and a third function to print an array. The main function should declare the arrays and use the functions to fill each array and print them both.
The code i have so far is
#include <cstdlib>
#include <iostream>
using namespace std;

void printaaray(int printarray1[], int printarray2);


void printarray(int printarray1[], int printarray2)
{
for (int n = 0; n < printarray2; ++n)
cout << printarray1[n] << ' ';
cout << '\n';
}
void array(int firstarray[])
{
for (int i = 0; i < 25; ++i)(firstarray[i]) = (i + 1);
srand(firstarray[5]);
}

int main()
{
int firstarray[5];
int secondarray[5] = { 2, 4, 6, 8, 10 };
printarray(firstarray, 5);
printarray(secondarray, 5);
system("pause");
return 0;
}
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
#include <cstdlib>
#include <iostream>
#include <ctime>

using namespace std;

void printaaray(int printarray1[], int array_size);


void printarray(int printarray1[], int array_size)
{
    for (int n = 0; n < array_size; ++n)
        cout << printarray1[n] << ' ';
    cout << '\n';
}
void fillarray(int firstarray[], int array_size)
{
    //Set random generator seed
    srand(time(0));
    for (int i = 0; i < array_size; ++i){
        //Fill each item with random generated number from 1 to 25 inclusive
        firstarray[i] = rand() % 25 + 1;
    }
}

int main()
{
    int firstarray[5];
    int secondarray[5] = { 2, 4, 6, 8, 10 };

    //Fill array with random numbers
    fillarray(firstarray, 5);

    //Print first array
    printarray(firstarray, 5);

    //Print second array
    printarray(secondarray, 5);

    system("pause");
    return 0;
}
thanks man! helped me alot
Topic archived. No new replies allowed.