//此函数用来寻找从右往左第1位~第K位数字中最大的数
//因为数组长度较小,采用递归排序的非链表方法
#include <stdio.h>
#include <ctype.h>
#include <stdbool.h>
#define div 10
#define N 10
typedef int cat;
cat digit(cat n, cat k); //拆分函数
void quick_sort(cat a[], cat low, cat high);
cat split(cat a[], cat low, cat high);
cat main(void)
{
cat i, e, num_re;
printf("please enter the number: \n");
scanf("%d", &i); //注意这里输入的是一串连续数字
printf("please enter the digit you want: \n");
scanf("%d", &e); //输入位数k
num_re = digit(i,e);
if (num_re != 0){ //判断返回值是否为真
printf("the number you want is: %d ", num_re);
}
else{
printf("Please enter the digit within the range\a");
}
return 0;
}
cat digit(cat n, cat k) //定义两个形式参数n,k
{
cat num = 0;
cat arr[div], g, temp, status;
if(n