Home > Back-end >  [for] loop statement is not according to the operation of the ideal
[for] loop statement is not according to the operation of the ideal

Time:10-24

#include
45,77,21 int a [3]={}, b [3]={1001100, 8100, 7}, I, n=3, the sum=0, cont=1, v, f, G, J, m, Jude, t=1;
char ch;
Int FindStudent (int [b])
{
The scanf (" % d ", & amp; F);
for(i=0; i{
If (b [I]==f)
Return the I;
}
Return to 5;
}
Int main ()
{
Printf (" please enter the student student id: \ n ");
J=FindStudent (b);
If (J> 0)
Printf (" \ n the student achievement is: % d ", a [J]);
The else
Printf (" no such person \ n ");
Do
{
Printf (" query whether or not to continue (y/n) : \ n ");
The scanf (" % c ", & amp; Ch);
If (ch=='y')
{
Printf (" please enter the student student id: \ n ");
J=FindStudent (b);
If (J> 0)
Printf (" \ n the student achievement is: % d ", a [J]);
The else
Printf (" no such person \ n ");
}
The else
T=1;
}
While (t> 0);
return 0;
}

CodePudding user response:

Should be the problem of system code

CodePudding user response:

But also right running order

CodePudding user response:

1001 is b [0] to return to zero, but your
If ( J> 0
Printf (" \ n the student achievement is: % d ", a [J]);
The else
printf (" no such person \ n ");


is no such person?
J>=0

CodePudding user response:

Ideal is very plentiful, reality is that
There are also a J> behind; 0 judgment, in the do {} while () loop body

Chinese garbled, depends on where you copy to come over words, words have a lot of coding, GB23123 GBK/double byte code,
If it is unicode utf-8/utf - 16, not

CodePudding user response:

 # include 

45,77,21 int a [3]={}, b [3]={1001100, 8100, 7};//, I, n=3, the sum=0, cont=1, v, f, G, J, m, Jude, t=1;
Int n=3;
//char ch;
Int FindStudent (int [b])
{
Int I, no;
The scanf (" % d ", & amp; No);
for(i=0; i{
If (b [I]==no)
return i;
}
Return to 5;
}
Int main ()
{
Int independence idx, ch.

Printf (" please enter the student student id: \ n ");
Independence idx=FindStudent (b);
//if (idx> 0)
If (independence idx & gt;=0)
Printf (" \ n the student achievement is: % d ", a [independence idx]);
The else
Printf (" no such person \ n ");
Do
{
Printf (" query whether or not to continue (y/n) : \ n ");
While ((ch=getchar ())=='\ n')
;
//the scanf (" % c ", & amp; Ch);
If (ch=='y')
{
Printf (" please enter the student student id: \ n ");
Independence idx=FindStudent (b);
//if (idx> 0)
If (independence idx & gt;=0)
Printf (" \ n the student achievement is: % d ", a [independence idx]);
The else
Printf (" no such person \ n ");
}
/*
The else
T=1;
*/
} while (ch!='y');

return 0;
}


For your reference ~

CodePudding user response:

The query cannot achieve unlimited time ah

CodePudding user response:

Int main ()
{
Printf (" please enter the student student id: \ n ");
J=FindStudent (b);
Do
{
If (J>=0)
Printf (" \ n the student achievement is: % d ", a [J]);
The else
Printf (" no such person \ n ");
Printf (" query whether or not to continue (y/n) : \ n ");
The scanf (" % c ", & amp; Ch);
}
While (ch=='y');
return 0;
}
Why do so while still doesn't work?
  • Related