Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void sort(){
- int temp;
- bool sorted = false;
- while(!sorted){
- for(int i = 0; i < n-1; i++){
- if(sum[i] > sum[i+1]){
- sorted = false;
- temp = sum[i];
- sum[i] = sum[i+1];
- sum[i+1] = temp;
- }
- }
- sorted = true;
- }
- }
- void reverse(){
- int temp;
- bool sorted = false;
- while(!sorted){
- for(int i = 0; i < n-1; i++){
- if(sum[i] < sum[i+1]){
- sorted = false;
- temp = sum[i];
- sum[i] = sum[i+1];
- sum[i+1] = temp;
- }
- }
- sorted = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement