2016校招机试题
第一题
输入一串用空格隔开的数字串,对于数字串的奇数位按升序排序,偶数位按降序排序示例输入:4 6 2 3 7 8 1
处理过程:
奇数位:4268升序排序结果:2468
偶数位:6371 降序排序结果:7631
结果输出:2 7 4 6 6 3 8 1
#include
#include
#include
void sort(char input[], int n, char output[]);
void main()
{
char input1[]="4 6 2 3 6 7 8 1";
char output1[16];
int m=15;
sort(input1,m,output1);