diff --git a/C++/binary search b/C++/binary search new file mode 100644 index 00000000..4ebfea11 --- /dev/null +++ b/C++/binary search @@ -0,0 +1,46 @@ + +#include + +int main() +{ + int a[10],c,t,m,n,num; + int beg,mid,end; + std::cout<<"Enter 10 numbers \n"; + for(c=0;c<10;c++) + std::cin>>a[c]; + std::cout<<"Enter the number"; + std::cin>>num; + + for(m=1;m<10;m++) + { + for(n=0;n<(10-m);n++) + { + if (a[n]>a[n+1]) + { + t=a[n]; + a[n]=a[n+1]; + a[n+1]=t; + } + + } + + } +std::cout<<"The sorted array is \n"; +for(c=0;c<10;c++) + std::cout<