用while输出所有形如aabb的四位完全平方数

1.使用while语句
2.输出所有形如aabb
3.四位完全平方数

有用请采纳!

#include <iostream>
#include<math.h>
using namespace std;
int main()
{
    int i=1000;
    while(i<10000)
    {
        int a= i/1000;
        int b= i/100%10;
        int c = i/10%100-b*10;
        int d = i-1000*a-100*b-10*c;
        if(a==b&&c==d&&i==(int)sqrt(i)*(int)sqrt(i))
            cout<<i<<" ";
        ++i;
    }
    cout<<endl;
    return 0;
}