error C2664 what should i do?

In the main function, initialize two arrays of the type int named Evens and Odds, each of the size 20. Intialize the array Evens with the first 20 even numbers, starting from 0. Initialize the array Odds with the first 20 odd numbers, starting from 1. Print the two arrays side by side, as shown in the sample input / output screen. Write a function Swap_Arrays that accepts the two arrays, Even and Odd, of the type int as the reference parameters, and the size of the arrays as the value parameter. The function will swap the two input arrays. Call the function Swap_Arrays from the main with Evens, Odds and their size as the parameters and after the function call display the swapped arrays in the reversed order.

i did first part but the second with function it gives me error how i can sole 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
69
70
71
72
73
74
75
76
77
78
79
80
#include<iostream>
#include<iomanip>

using namespace std;
const int size=20;


void Swap_Arrays ( int  & evenary,  int & oddary,const int sizeofarray);


int main()
{
	
	

    
	int evenarray[size],oddarray[size],i,odd=1,even=0;

	
	
	for(i=0;i<20;i++)
	{

		evenarray[i]=even;
		even+=2;

		oddarray[i]=odd;
		odd+=2;
	}

	cout<<"Evens"<<setw(6)<<"Odd"<<endl;
	
	for(i=0;i<20;i++)
	{

		cout<<evenarray[i]<<setw(8)<<oddarray[i];

		cout<<endl;
	}



	 Swap_Arrays (evenarray,oddarray,size);


	 return 0;
}




	

void Swap_Arrays (  int evenary[], int oddary[],const int sizeofarray)
{
	int j,evennum=0,oddnum=0;
		for(j=0;j<sizeofarray;j++)
	{

		evenary[j]=evennum;
		evennum+=2;

		oddary[j]=oddnum;
		oddnum+=2;
	}

	
	


	
	cout<<"Evens"<<setw(6)<<"Odd"<<endl;
	for(j=sizeofarray;j<=0;j--)
	{
		
		cout<<evenary[j]<<setw(8)<<oddary[j];

		cout<<endl;
	}
}
Last edited on
Topic archived. No new replies allowed.