From 2995a0f15aa0a01db266cc0f49b6b7ebbde2eae2 Mon Sep 17 00:00:00 2001 From: Washington Igor <44528933+Washhh@users.noreply.github.com> Date: Thu, 29 Oct 2020 16:04:15 -0300 Subject: [PATCH] Create Odd even ordenation --- basic_programs/Odd even ordenation | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 basic_programs/Odd even ordenation diff --git a/basic_programs/Odd even ordenation b/basic_programs/Odd even ordenation new file mode 100644 index 0000000..b8cfc65 --- /dev/null +++ b/basic_programs/Odd even ordenation @@ -0,0 +1,47 @@ +#include +#include +using namespace std; + +int main() { + int i[1000],p[1000],x,y,contI=0,contP=0,j; + cin>>y; + for(j=0;j> x; + if(x%2==0){ + p[contP]=x; + contP++; + } + else{ + i[contI]=x; + contI++; + } + } + int aux; + for (int k = 1; k < contP; k++) { + for ( j = 0; j < contP - 1; j++) { + + if (p[j] > p[j + 1]) { + aux = p[j]; + p[j] = p[j + 1]; + p[j + 1] = aux; + } + } + } + for (int k = 1; k < contI; k++) { + for ( j = 0; j < contI - 1; j++) { + + if (i[j] < i[j + 1]) { + aux = i[j]; + i[j] = i[j + 1]; + i[j + 1] = aux; + } + } + } + for(int o=0;o