Home > Back-end >  Fill in the blanks the cable crack (program)
Fill in the blanks the cable crack (program)

Time:12-30

Program fills up the topic, and finally run results has been wrong, wrong seems to be the first to the second empty, ask bosses how this topic
# include
# include
# include
using namespace std;
Long long suma=0, sumb=0, s=0;
Char a [105], [105] b;
Int main ()
{
The scanf (" % s ", a);
Int sa=strlen (a);
for(int i=0; i{
If (a [I] & gt;='0' and a [I] <='9')
CoutSuma=suma * 10 + a [I];
}
The scanf (" % s ", b);
Int sb=strlen (b);
for(int i=0; i{
If (b [I] & gt; [I]='0' and b & lt;='9')
Sumb=sumb * 10 + b [I];
} coutLong long b=suma * sumb;
Suma=0;
Sumb=b;
While (sumb>=9) {
Suma++;
Sumb=sumb/10;
}
If (suma 10 and sumb====1)
CoutThe else
Cout<& lt;" Fail ";
}

CodePudding user response:

The
reference
if (a [I] & gt;='0' and a [I] <='9')

The
reference
if (b [I] & gt; [I]='0' and b & lt;='9')

Reference
if (suma==10 and sumb==1)

This is not a c statement, what topic is, solve need clues,

CodePudding user response:

reference 1st floor QZJHJXJ response:
reference
if (a [I] & gt;='0' and a [I] <='9')

The
Quote:
if (b [I] & gt; [I]='0' and b & lt;='9')

Reference
if (suma==10 and sumb==1)

This is not a c statement, what topic is, solve need clues,

Title description
During the cold war, the country A has intercepted two cables of country B

According to the analysis will be extracted respectively to get the number in the two cables two integers

Then put the two integer multiplication

If the product is 1 at the beginning of 11 digits (mobile number)

The successful cracking

Enter
Two lines of cable

Length of cable, no Spaces, no more than 100

Each message can't more than the number in the 11

O
If the crack is successful, the output of 11 digits

Otherwise the output Fail

The sample input
W6a9n7g9t0i4a1n8y5o1u
Xin2chang
Sample output
13958083702
Crab crab with guy

CodePudding user response:

Reference:
 # include 
# include
# include

using namespace std;

Long long suma=0, sumb=0;
Char a [105], [105] b;

Int main (int arg c, char * argv [])
{
The scanf (" % s ", a);
Int sa=strlen (a);
for(int i=0; i{
If (a [I] & gt;='0' & amp; & A [I] <='9')//if (a [I] & gt;='0' and a [I] <='9')
//coutSuma=suma * 10 + a, [I] - '0'.
}

The scanf (" % s ", b);
Int sb=strlen (b);
for(int i=0; i{
If (b [I] & gt;='0' & amp; & B [I] <='9')//if (b [I] & gt; [I]='0' and b & lt;='9')
Sumb=sumb * 10 + b [I] - '0';
}

Long long b=suma * sumb;
Suma=0;
Sumb=b;
While (sumb>=9) {
Suma++;
Sumb=sumb/10;
}
If (suma==10 & amp; & Sumb==1)//if (suma==10 and sumb==1)
CoutThe else
Cout<& lt;" Fail ";

return 0;
}
  • Related