Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  H
Language: C/C++
Code:
#include <stdio.h>
int main(int argc, char *argv[])
{
Const it n=12;
Int x[n];
Int item ; found=0, low=0, high=n_1;
Int mid;
For(int i=0,i<n,i++)
Cin>>x[i];
Cin>>item;
While(found==0,and low<=high)
{
Mid=(low+high)/2;
If(item>x[mid])
Low=mid+1;
Else if(item<x[mid])
High=mid-1;
Else
Found=1;
}
If(found==1)
Cout<<"found";
Else
Cout<<"not found";
Return 0;
}
Comments: