Home > Back-end >  Trouble to help me take a look at this program
Trouble to help me take a look at this program

Time:05-04

At the same time to satisfy the following conditions of all three positive integers:

The square of the number is a double digits;

(2) the number of the single digits, the ten digits and figures;

(3) the number of the single digits, ten digits and figures in descending order,

Requirements will determine whether an integer satisfy conditions 1) designed to function f1: if meet the conditions, it returns 1, otherwise back to 0; And through the reference type parameters back to the square root (two digits), whether at the same time satisfy the condition (2) and (3) designed to function f2, call the function in the main function, the output meet all the conditions of three digits corresponding double digits, and the condition of the output of the program is as follows:

13 ^ 2=169

256=16 ^ 2

17 ^ 2=289
#include
using namespace std;
Int f1 (int & amp; Y) {
Int j;
For (j=10; J<32. J++)

If (j * j>=y)

break;

The return of y=((j * j)==y? J: 0);

}

{int f2 (int n2)

Int a, b, c;

A=10, n2 % b=10% n2/10, c=n2/100;

If (a!=b& & b!=c& & a!=c& & a> B& & b> C)

return 1;

return 0;

}



Int main ()



{



Int n, n2, t;



For (n=100; n<=999; N++)
{
N2=n;
If (t=f1 (n) & amp; & F2 (n2))



cout


}



return 0;



}

CodePudding user response:

Modified as follows, for your reference:
 # include 
using namespace std;
Int f1 (int y)//int f1 (int & amp; Y) {
{
Int j;
For (j=10; J<32. J++)
If (j * j>=y)
break;
Return ((j * j)==y? J: 0);//return y=((j * j)==y? J: 0);
}

Int f2 (int n2)
{
Int a, b, c;
A=10, n2 % b=10% n2/10, c=n2/100;
If (c B& & b> C)
return 1;
return 0;
}

Int main ()
{
Int n, t;//n2;
For (n=100; n<=999; N++)
{
//n2=n;
If ((t=f1 (n)) & amp; & F2 (n))//if (t=f1 (n) & amp; & F2 (n2))
cout}

return 0;
}
  • Related