________________; // (1)
________________; // (2)
if((a+b)*(a+b)==n)
cout<<n<<" ";
}
cout<<endl;
return 0;
}
7.求方程cos(x)-x=0的根
This program is to find the real root of function cos(x)-x=0.
#include <iostream>
#include <cmath>
using namespace std;
int main() {
float x0,x1=0.0;
while(1)
{
________________; // (1)
________________; // (2)
if(fabs(x0-x1)<1e-6)
break;
}
cout<<"The real root is "<<x1<<endl;
return 0;
}
8.特殊的3位数
This program is to find the Perfect Square Numbers. which have 3 digits, and 2 of them are the same. e.g.100, 121, 144, 225, 400, 441, 484, 676, 900.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int i,n,a,b,c;
for (i=10;i<=sqrt(1000);i++)
{
_______________; // (1)
a=n/100;
_______________; // (2)
c=n%10;
if (a==b || a==c || b==c)
cout<<n<<" ";
}
cout<<endl;
return 0;
}
9.三重回文数
This program is to find the Palindrome Numbers. whose square and cubic are also Palindrome Numbers.
#include <iostream>
using namespace std;
bool isPalindrome(int n)
{
&