#include <fstream>
#include <iostream>
然后main()改写:
void main()
{
ofstream fout("output.txt");
cout<<"在11~999之间这样的数有";
fout<<"在11~999之间这样的数有";
for(int n=11;n<=999;n++)
{
if(hw(n)&&hw(n*n)&&hw(n*n*n)){
cout<<n<<" ";
fout<<n<<" ";
}
}
cout<<"\n";
fout<<"\n";
}
温馨提示:答案为网友推荐,仅供参考