I have to see which of the following from a vector is a square number then make another vector with only the square numbers
For example: (4,15,6,25,7,81) the second will be (4,25,81)
4,25,81 because 2x2=4 5x5=25 and 9x9=81
I started like this:
{
int A[100],n,r,i;
cout<<"Number of elements=";
cin>>n;
for(i=1;i<=n;i++)
{
cout<<"A["<<i<<"]=";
cin>>A[i];
}
for(i=1;i<=n;i++)
{
r=sqrt(A[i]);
if(r*r==A[i])
}
return 0;
}
but I am not really sure how to continue