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
#include<iostream>
#include<iomanip>
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;
}