# define 40 N
Int ReadScore (int income [], long num []);
Int LinSearch (long num [], long x, int n);
Int main ()
{
Int income [N], N, pos;
Long num [N], x;
N=ReadScore (income, num);
Printf (" Total number is % d \ n ", n);
Printf (" Input the searching ID: ");
The scanf (" % d ", & amp; X);
Pos=LinSearch (num, x, n);
If (pos!=1)
{
Printf (" income=% d \ n ", income (pos));
}
The else
{
Printf (" Not found! \n");
}
return 0;
}
Int ReadScore (int income [], long num [])
{
int i;
Do {
i++;
Printf (" Input the person 's ID and income: ");
The scanf (" % d % d ", & amp; Num [I], & amp; Income [I]);
}
While (num [I] & gt; 0 & amp; & ReadScore [I] & gt;=0);
return i;
}
Int LinSearch (long num [], long x, int n)
{
Int I;
for (i=0; i<=n; I++)
{
If (num [I]=x) return (I);
}
The return (1);
}
CodePudding user response:
ReadScore I there is initializedCodePudding user response:
And an array of ReadScore [I] is not defined, you should be income [I] have the wrong number.And a function under the num=x [I] what is the fairy
CodePudding user response:
Int ReadScore (int income [], long num []){
Int I =0 ;
Do {
i++;
Printf (" Input the person 's ID and income: ");
The scanf (" % d % ld ", & amp; Num [I], & amp; Income [I]);
} while ( I
//ReadScore [I] don't have the array, don't know what you want to express
return i;
//this I still could be out from while the condition of N, then return to this I should not be, or have potential risks
}
Int LinSearch (long num [], long x, int n)
{
Int I;
for (i=0; i<=n; I++)
{
If (num [I] == x) return (I);
}
The return (1);
}