We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97dc424 commit cfe6cb7Copy full SHA for cfe6cb7
Queue/Circular Queue DS Operations.cpp
@@ -0,0 +1,36 @@
1
+#include < iostream >
2
+ using namespace std;
3
+
4
+void bubbleSort(int a[]) {
5
+ for (int i = 0; i < 5; i++) {
6
+ for (int j = 0; j < (5 - i - 1); j++) {
7
+ if (a[j] > a[j + 1]) {
8
+ int temp = a[j];
9
+ a[j] = a[j + 1];
10
+ a[j + 1] = temp;
11
+ }
12
13
14
+}
15
16
+int main() {
17
+ int myarray[5];
18
+ int size;
19
+ cout << "Enter 5 integers in any order: " << endl;
20
21
+ cin >> myarray[i];
22
23
+ cout << "Before Sorting" << endl;
24
25
+ cout << myarray[i] << " ";
26
27
28
+ bubbleSort(myarray); // sorting
29
30
+ cout << endl << "After Sorting" << endl;
31
32
33
34
35
+ return 0;
36
0 commit comments