Sorting program using only while statements

I am just starting out learning C++ and I am looking for some insights on how to get started writing this program. I am looking to learn, not have it solved for me. I have to create a program that will sort an array of integers (positive or negative or zeros) size n in increasing order, using only while or do-while statements. The program must include the user imputing the size of the set and the set itself (I know how to set that up though). Any help that can be provided will be enormously appreciated
Last edited on
Create "temporary" variable to hold one of the values so you can sort them.

1
2
3
4
5
6
if(a>b)
{
  t=a;
  a=b;
  b=t;
}
Last edited on
Topic archived. No new replies allowed.