Skip to content

Commit cfe6cb7

Browse files
authored
Create Circular Queue DS Operations.cpp
Circular Queue - DS Operations
1 parent 97dc424 commit cfe6cb7

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
for (int i = 0; i < 5; i++) {
21+
cin >> myarray[i];
22+
}
23+
cout << "Before Sorting" << endl;
24+
for (int i = 0; i < 5; i++) {
25+
cout << myarray[i] << " ";
26+
}
27+
28+
bubbleSort(myarray); // sorting
29+
30+
cout << endl << "After Sorting" << endl;
31+
for (int i = 0; i < 5; i++) {
32+
cout << myarray[i] << " ";
33+
}
34+
35+
return 0;
36+
}

0 commit comments

Comments
 (0)