I have a recursive function squares that receives a positive integer n and prints out the first n perfect squares in descending order. Can anyone tell me if this is correct and if not please help.

squares(int n)
{
if( n== 1 )
return 1;

else
return squares ) n * n );
}
void squares(int n)
{
    if( n== 1 ) 
        cout << 1 ;
    else
    {
         cout << n*n << " " ;//swap lines 7 & 8 for ascending order
         squares ( n- 1 );
    }
}

Thanks for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.