diff --git a/arrays/reverse-array/reversearray.cpp b/arrays/reverse-array/reversearray.cpp new file mode 100644 index 0000000..f8ff925 --- /dev/null +++ b/arrays/reverse-array/reversearray.cpp @@ -0,0 +1,39 @@ + +// REVERSE AN ARRAY + +#include +using namespace std; + +void reArr(int arr[],int start ,int last){ // function to reverse array + + int temp; + + while(start >n; + int arr[n]; + cout<<"Enter the element of array\n"; + + for(int i=0;i>arr[i]; + } + reArr(arr,0,n-1); // function for reverse array element + cout<<"Reversed array\n"; + + for(int i=0;i +using namespace std; //std::cout or std::cin + +int main(){ + int n,t; + cout<<"enter test cases"<>t; + //cout<<(sizeof(arr)/sizeof(arr[0])); sizeof(arr) = datatype of arr * number of variable + while(t--){ + cout<<"enter size of array "<>n; + int arr[n]; + + cout<<"Enter array element\n"; + + for(int i=0;i>arr[i]; + } + + int key; + cout<<"enter key to search"<>key; + + int low=0,high=n-1, flag=0; + for(int i=0;ikey){ + high= mid-1; + } + else if(arr[mid] +using namespace std; + +int main(){ + int n; // size of array + cout<<"enter size of array"<>n; + int arr[n]; // array to store all the elements + + cout<<"Enter array element\n"; + for(int i=0 ;i>arr[i]; // loop for entering array + } + int key; // key variable to be search + cout<<"enter key to be search"<>key; + int i =0 ,flag =0 ,count =0,lastpos; + for(i =0 ; i