Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Scanning multiple forming
Scanning multiple forming
# include & ltstdio.h & gt

void main()

{ int i,x,a[ 10],pos,low,high,mid

Printf ("Please enter data in descending order: \ n");

for(I = 0; I< 10; i++)

{ scanf("%d ",& ampa[I]);

}

Printf ("Please enter the data you want to find:");

scanf("%d ",& ampx);

pos =- 1;

Low = 0;

Height = 9;

do

{mid = high+low/2;

if(x & gt; A [middle]

? Low = mid+1;

else if(x & lt; A [middle]

? High = medium1;

other

{ pos = mid

? Break;

}

}

while(low & lt; = high);

If (pos! =- 1)

Printf ("subscript position of data: %d", POS);

Else printf ("Not found!" );

}