calculating squares of an array

Hello, I'm completely new at this and I'm not sure how to calculate the square of the elements of an array of 4 numbers?
int a[4] = {1,2,3,4};
for(int x = 0; x < 4; x++)
cout << a[x]*a[x] << endl;

you can compute more complicated powers with the pow() function, but here a multiply is all you need, and it illustrates accessing the array.

Topic archived. No new replies allowed.