Searching in Arrays:- The process of finding the required data in an array is called searching. It is very useful when the size of an array is very large. ...
Statements of C++ Programming:- Following statements are used in C++, normally inside the loops. 1. Continue Statement. 2. Break Statement. 3. Goto ...
The pointers in C++ are simple variables which is declared by using the asterisk sign before the variable. It is used to store the memory addresses of data ...
For any questions, suggestions and inquiries you could directly email me on admin@hellgeeks.com
What information do we collect? We collect information from you when you register on our site or subscribe to our newsletter. When ordering or registering ...
The switch statement in C++ is a conditional structure. This statement is a really good alternative of nested if-else. It is used in a situation when there are ...
- « Previous Page
- 1
- …
- 8
- 9
- 10
just write if(array[j] lesser then array[j+1]) instead of if(array[j] greater then array[j+1]) and it will sort the array in descending order.
I have updated my comment with a code block containing while loop, cheers.
Okay, that’s the code of Bubble sort by using While Loop written in C++.
while(i < 4) { int j = 0; while(j < 4) { if(array[j]>array[j+1])
{
hold=array[j];
array[j]=array[j+1];
array[j+1]=hold;
}
j++;
}
i++;
}
If you have any other questions then let me know, thanks.
yes we can use a while loop.
Welcome
thanks for pointing out.
my pleasure :)
thanks for pointing out !!!