ascending, Odd in front, even in the rear
Your own code:
1 /*2 March 14, 2017 12:52:393 functions: ascending, Odd in front, even in the rear4 */5#include"stdio.h"6 intMain ()7 {8 intj =0, k =0;9 inta[Ten];Ten intb[Ten]; one intc[Ten]; a int*PA =a; - -printf"please input number: \ n"); the for(inti =0; I <Ten; i++) - { -printf"please input%dth number:", i+1); -scanf"%d",&a[i]); + if(a[i]%2==0) -b[j++] =a[i]; + Else ac[k++] =a[i]; at - } - - int*PB =b; - int*PC =c; - in for(intp =0; P < j; p++) - for(intP1 = p; P1 < j; P1++)//int p1 = 1 cannot be defined here; to if(b[p] >=b[p1]) +b[p1] =b[p]; - the for(intQ =0; Q < k; q++) * for(intQ1 = q; Q1 < k; q1++) $ if(c[q] >=c[q1])Panax Notoginsengc[q1] =c[q]; - the while(j)//You cannot jump out of a loop with a while (*PC) statement here + { a*PA = *pc; thepa++; +Pc++; -j--; $ } $ while(k) - { -*PA = *pb; thepa++; -pb++;Wuyik--; the } - for(i =0; I <Ten; i++) wuprintf"%d", a[i]); - about return 0; $ } - /* - summary: - results shown in vc++6.0:: a —————————————————————————— + please input Number: the please input 1th number:1 - please input 2th number:2 $ please input 3th number:3 the please Input 4th Number:4 the please Input 5th Number:5 the please Input 6th Number:6 the please input 7th Number:7 - please input 8th Number:8 in please input 9th Number:9 the please input 10th number:10 the 1 3 5 7 9 2 4 6 8 about the —————————————————————————— the the */
C Language Code programming questions Summary: ascending, odd in front, even in the rear