User Posts: royal52
0
Sequential Search in C++ with examples
3

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. ...

0
Continue, Break and Goto Statements in C++ with examples
0

Statements of C++ Programming:- Following statements are used in C++, normally inside the loops. 1. Continue Statement. 2. Break Statement. 3. Goto ...

0
Pointers in C++ with examples
2

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 ...

0
Contact Us
0

For any questions, suggestions and inquiries you could directly email me on admin@hellgeeks.com  

0
Privacy Policy
0

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 ...

0
Switch Statement in C++ with examples
1

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 ...

Browsing All Comments By: royal52
  1. 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.

  2. I have updated my comment with a code block containing while loop, cheers.

  3. 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.

  4. yes we can use a while loop.

  5. thanks for pointing out.

  6. thanks for pointing out !!!

HellGeeks
Logo