Need help fixing print function!

It's supposed to print each element of the array but it doesn't


#include <iostream>
#include <cstdlib>

using namespace std;

void start (int boxes [10]);
void move (int squares [10], int x, int y, int z);
void add (int arr [10], int first, int last);
void print (int arr [10]);

int main ()
{
int my_arr [10];

cout << "The original array is:\n";
print (my_arr);

start (my_arr);
cout << "\n\nThe array after start is:\n";
print (my_arr);

move (my_arr, 2, 4, 6);
cout << "\n\nThe array after move is:\n";
print (my_arr);

add (my_arr, 3, 7);
cout << "\n\nThe array after add is:\n";
print (my_arr);

cout << "\n\n";
}


void start (int boxes [10])
{
int index, count;

count = 17;
for (index = 0; index < 10; index++)
{
boxes [index] = count;
count--;
}
}

void move (int squares [10], int x, int y, int z)
{
int temp;

temp = squares [x];
squares [x] = squares [y];
squares [z] = squares [y];
squares [y] = temp;
}

void add (int arr [10], int first, int last)
{
int m;

for (m = first; m <= last; m++)
arr [m]++;
}

void print (int arr [10])
{
int z;

for (z = 0; z < 10; z++)
cout << z << " ";
}
try this :
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
59
60
61
62
63
64
65
66
67
68
#include <iostream>
#include <cstdlib>

using namespace std;

void start (int* boxes);
void move (int squares [10], int x, int y, int z);
void add (int arr [10], int first, int last);
void print (int arr [10]);

int main ()
{
	int my_arr [10] = {0};

	cout << "The original array is:\n";
	print (my_arr);

	start (my_arr);
	cout << "\n\nThe array after start is:\n";
	print (my_arr);

	move (my_arr, 2, 4, 6);
	cout << "\n\nThe array after move is:\n";
	print (my_arr);

	add (my_arr, 3, 7);
	cout << "\n\nThe array after add is:\n";
	print (my_arr);

	cout << "\n\n";
	system("pause");
}


void start (int* boxes )
{
	int index = 0, count = 17;

	for (; index < 10; index++)
		*(boxes + index) = count --;
		
}

void move (int squares [10], int x, int y, int z)
{
	int temp = 0;

	temp = squares [x];
	squares [x] = squares [y];
	squares [z] = squares [y];
	squares [y] = temp;
}

void add (int arr [10], int first, int last)
{
	int m = 0;

	for (m = first; m <= last; m++)
	arr [m]++;
}

void print (int arr [10])
{
	int z = 0;

	for (z = 0; z < 10; z++)
	cout << arr[z] << " ";
}
Yes! That's perfect, thank you!
you're welcome.
Topic archived. No new replies allowed.