From ea90fbd2b6d7abb8c155c0afa5555ce72f1203aa Mon Sep 17 00:00:00 2001 From: "T.Y.M.SAI" Date: Thu, 25 Nov 2021 19:10:43 +0530 Subject: [PATCH] Update bubbleSort.cpp --- cpp/bubbleSort/bubbleSort.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cpp/bubbleSort/bubbleSort.cpp b/cpp/bubbleSort/bubbleSort.cpp index 18c85e4..dfa71b4 100644 --- a/cpp/bubbleSort/bubbleSort.cpp +++ b/cpp/bubbleSort/bubbleSort.cpp @@ -1 +1,18 @@ // Add your code here +#include +using namespace std; + +int main(){ + int arr[10]={9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, temp=0, hold=0, etyp=0; + for(int i=0; i<9; i++){ + for(int j=0; j<9; j++){ + if(arr[j]>arr[j+1]){ + temp=arr[j+1]; + arr[j+1]=arr[j]; + arr[j]=temp; + } + } + } + for(int i=0; i<10; i++) + cout<