I need some help on Arrays. Here is the project I'm working on.
Write a program to read the items into two arrays, x and y, of size 20.
Store the products of corresponding pairs of elements of x any in a third away, z, also of size 20. Print a three-column table that displays the arrays x, y, and z. Then compute and print the square root of the sum items Z.

Now I have some of the code done and what I need advice in is how to take the numbers of arrays x and y, add them, make the square root and to store them in the new array called Z.

Thanks for any future advice.

// Warren Culp
// 9/27/09
// Prof. Yoa

using namespace std;

int main()

int X[20], Y [20];

cout << "Please enter 20 numbers for row 1" << endl;

for(int count = 0; count < 20; count++)
	cin >> X[count];
cout << endl;
cout << "Please enter 20 numbers for row 2" << endl;

for (int count = 0; count < 20; count++)
	cin >> Y[count];

cout << "The contents of both arrays are" << endl;
cout << endl;
cout << "Array X" << " " << "Array Y" << endl;
cout << "---------------------------" << endl;
for (int count = 0; count < 20; count++)
	cout << X[count] << " " << Y[count];
return 0;


Declare a new array called Z[20].
Then use the following code to add the corresponding numbers.

for (int count = 0; count < 20; count++)

This code says:
Take the values at position 'count' of arrays X and Y and add them together. Then place that value into position 'count' of array Z.
Follow the previous post to learn about square roots.

Just a quick note, since you look like you are going to get confused.
You really need to be working with double or floats, e.g.
3.4 or 34003.384 or 1.87561e2. Even if you input standard integers
sqrt(2) is not an integer.

You are also going to have to test for numbers below zero. Are you going to accept sqrt(-1) (which is the complex number (0,i))