+ 2
sort an array
Arrange the even elements in ascending order and in descending order the odd elements of one array of at least 5 elements, numbers whole two digits each. Will be used both methods: SelectionSort & BubbleSort. Exemple: input: 5 64 25 16 81 49 36 output: 16 25 36 49 64 81 I tried something, didn't worked. https://code.sololearn.com/c2QXwKFVn1SR/#cpp
6 Respuestas
+ 6
Would you kindky learn reading error messages?!!
There are two simple brackets missing.
I won't tell you where...
Anyways.. good job. Your prog is not so bad.
+ 4
Are you guys classmates?
https://www.sololearn.com/Discuss/2160288/?ref=app
+ 4
#include <bits/stdc++.h> 
using namespace std; 
  
int main() 
{ 
    int arr[] = {1, 5, 8, 9, 6, 7, 3, 4, 2, 0}; 
    int n = sizeof(arr)/sizeof(arr[0]); 
  
    sort(arr, arr+n); 
  
    cout << "\nArray after sorting using " 
         "default sort is : \n"; 
    for (int i = 0; i < n; ++i) 
        cout << arr[i] << " "; 
  
    return 0; 
}
+ 2
Avinesh 😂 both from Moldova.
+ 1
Very easy by using sort fn from stl
0
Please follow and upvote if the answer helped you :)








