From ca68cf4911236f18762038b0cd85341d70000f71 Mon Sep 17 00:00:00 2001 From: Priyansha Nayak <87187181+PriyanshaNayak@users.noreply.github.com> Date: Mon, 11 Oct 2021 10:25:52 +0530 Subject: [PATCH 1/2] Made some changes --- .vscode/launch.json | 19 ++++++++++++ .../Searching/binarySearchIterative.cpp | 29 +++++++++---------- 2 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..b848355 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,19 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(Windows) Launch", + "type": "cppvsdbg", + "request": "launch", + "program": "enter program name, for example ${workspaceFolder}/a.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "console": "externalTerminal" + } + ] +} \ No newline at end of file diff --git a/C++/Algorithm/Searching/binarySearchIterative.cpp b/C++/Algorithm/Searching/binarySearchIterative.cpp index c3b62b8..c073506 100644 --- a/C++/Algorithm/Searching/binarySearchIterative.cpp +++ b/C++/Algorithm/Searching/binarySearchIterative.cpp @@ -31,19 +31,18 @@ int binarysearch(vector < int > & arr, int ele) { } return -1; } - -int main() { - vector arr{ 2, 3, 5, 10, 35, 40 }; //sorted array - - int element = 10; // element to find - - int result = binarysearch(arr, element); - - if (result == -1) { // if element not present in array. - cout << "Element is not present in array"; - } else { - cout << "Element is present at index " << result; +int main() +{ + vector arr{2,3,5,10,35,40}; //sorted array + int element=10; //element to find + int result= binarysearch(arr,element); + if(result==-1) //if element is not present + { + cout<<"Element is not present in array."; } - - return 0; -} + else + { + cout<<"Element is present at index-"< Date: Mon, 11 Oct 2021 20:41:25 +0530 Subject: [PATCH 2/2] Added a new program --- .vscode/launch.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index b848355..dce5ccd 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,7 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { "name": "(Windows) Launch", "type": "cppvsdbg",