Home > Back-end >  Novice beg god to explain
Novice beg god to explain

Time:09-16

#include
#include
#include
Void main ()
{
Int a [3] [4], I, j, found;
Printf (" please enter the 12 digital \ n ");
for (i=0; i <3; I++)
For (j=0; J & lt; 4. J++)
{
The scanf (" % d ", & amp; A [I] [j]);
}
Found=0;
for (i=0; i <3 & amp; & ! The found. I++)
For (j=0; J & lt; 4 & amp; & ! The found. J++)
{
If (a [I] [j] <0)
Found=1;
}
if (! Found)
{
Printf (" found no \ n ");
}
The else
{
Printf (" minus number num [% d] [] % d: % d \ n ", I - 1, j - 1, a [I - 1] [1]).
}
system("pause");
}


Founf, here! Found the loop condition is what? What's the cycle of, how to match? Great god please explain in detail

CodePudding user response:

! Found is found to zero value take thought for the non-zero value condition is established, which is found to zero value this! Found the condition is established for true

CodePudding user response:

Check each number until I met a negative number to jump out of the loop, met negative, so why don't meet! The found? Why positive meet! The found?

CodePudding user response:

If (a [I] [j] <0)
Found=1; -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - met with negative, found 1,! The found of 0, the condition is false, out of circulation

CodePudding user response:

Thank you, brother!
To help me to explain why the input is a positive number fits! Foung that have been circulating bottom go to,

CodePudding user response:

Found=0; Initially found 0,! Found the not for 1, that is, true, condition is true until the end, except in a negative number, found 1,
! Found the not to 0, the condition is false, cyclic interrupt

CodePudding user response:

A: wow! Thanks brother, I am a beginner, self-taught, thank you for me to explain
You can add a VX or QQ? Hey hey, want to study together,

EMM, the last one doubt,
Why have negative found is equal to 1? Is really the last one, trouble you too much,

CodePudding user response:

If (a [I] [j] <0)
Found=1; -- -- -- -- -- -- -- -- -- -- -- -- here have negative not just buy 1

CodePudding user response:

Found=0
! Found=1 if

Found!=0
! Don't carry out the if found=0
  • Related