注意有些用法只有vs才有的哟,在其他环境里请把scanf_s改成scanf。
以及一些头文件需要自己添加,比如stdlib.h,math.h这类的呐。
逆波兰运算的bug已经修复了的,其实之前就是没好好写栈,然后重写了一遍。。。
求赞助啊,双十一把琥珀穷死了QAQ。
有问题找不到咱的话在底下评论试试吧。

一.

//递归式选择排序
#include<stdio.h>
#include <iostream>

int* seletion_sort(int n,int in[]);
void sele_sort(int in[], int i, int n);
int main()
{
    int n = 0;
    int in[1000] = { 0 };
    int* out;
    printf("Enter the number:");
    scanf_s("%d", &n);
    printf("Enter the numbers to be sort:");
    for (int i = 0; i < n; i++) {
        scanf_s("%d", &in[i]);
    }
    sele_sort(in, 0, n);
    printf("The result is n");
    for (int i = 0; i < n; i++)
        printf("%d ", in[i]);

}

void sele_sort(int in[], int i, int n) {    //i为排序初始位,n为排序个数
    int j, min, t;
    if (i < n - 1) {
        min = i;
        for (j = i + 1; j < n; j++) {       //每次递归寻找从i到n个中的最小值并交换放在最前面
            if (in[j] < in[min])
                min = j;                    //记录最小值出现的位置
        }
        t = in[min];                        //交换数值
        in[min] = in[i];
        in[i] = t;
        sele_sort(in, i + 1, n);            //进入下一次递归
    }
}

二.

//递归计算x^n
#include<stdio.h>
#include <iostream>

long long xn(int x, int n);
int main()
{
    int x = 0, n = 0;
    long long out = 0;
    printf("Enter the x and n:");
    scanf_s("%d %d", &x, &n);
    out = xn(x, n);
    printf("The result is %lld", out);
}
long long xn(int x, int n) {
    if (n == 1)return x;                //达到一直接返回自身
    else return x * xn(x, n - 1);       //递归
}

三.

//逆波兰运算法,已修复bug,可正常使用
#include<stdio.h>
#include <iostream>
#define Max_size 1000          //栈最大长度

char op[Max_size] = { 0 };
char* ctrl = &op[Max_size-1];   //栈的全局操作指针
void Reset(void);
int CheckLimit(void);
int CheckBottom(void);
int InStack(char t);
char OutStack(void);

int main()
{
    while (1) {
        Reset();                                                        //初始化栈
        printf("Enter an RPN expression:");
        while (1) {                                                     //循环读取数字和操作符并运算
            char n;
            scanf_s("%c", &n);
            if (n == 32)continue;                                       //无视空格读取
            if (n == '0' || n == '1' || n == '2' || n == '3' || n == '4' || n == '5' || n == '6' || n == '7' || n == '8' || n == '9') {
                if (InStack(n - 48) == -1)return 0;                     //将数字存入栈
            }
            else if (n == '+') {
                char t0, t1;
                if ((t0 = OutStack()) == -1)return 0;                   //第一个数字出栈,并判断是否有足够的数字
                if ((t1 = OutStack()) == -1)return 0;                   //第二个数字同理
                InStack(t1 + t0);                                       //计算并入栈,下面同理
            }
            else if (n == '-') {
                char t0, t1;
                if ((t0 = OutStack()) == -1)return 0;
                if ((t1 = OutStack()) == -1)return 0;
                InStack(t1 - t0);
            }
            else if (n == '*') {
                char t0, t1;
                if ((t0 = OutStack()) == -1)return 0;
                if ((t1 = OutStack()) == -1)return 0;
                InStack(t1 * t0);
            }
            else if (n == '/') {
                char t0, t1;
                if ((t0 = OutStack()) == -1)return 0;
                if ((t1 = OutStack()) == -1)return 0;
                InStack(t1 / t0);
            }
            else if (n == '=')break;
        }
        printf("Value of expression:%dn", op[999]);
    }

}

void Reset(void) {                                      //初始化栈
    memset(op, 0, Max_size);                            //归零,默认char长度为1
    ctrl = &op[Max_size-1];                             //指针归位
}
int CheckLimit(void) {                                  //检查栈上限,若达到上限返回1
    if (ctrl == op ) {  
        printf("Expression is too complex.");
        return 1;
    }
    return 0;
}
int CheckBottom(void) {                                 //检查栈下限,若达到下限返回1
    if (ctrl == &op[999]) {
        printf("Not enough operands in expression.");
        return 1;
    }
    return 0;
}
int InStack(char t) {                                   //入栈
    if (CheckLimit())return -1;                         //若达到栈上限,则无法再存入,返回-1
    *ctrl = t;
    ctrl--;
    return 0;
}
char OutStack(void) {                                   //出栈
    if (CheckBottom())return -1;                        //若达到栈下线,则无法再取出,返回-1
    char t = *(ctrl+1);
    ctrl++;
    return t;
}

四.

//判断2-5000中的数是否本身是素数,每位是素数,每位之和是素数
#include<stdio.h>
#include <iostream>
int IsPrime(int value);
int sum(int x);
int main()
{
    for (int i = 2; i <= 5000; i++) {
        int out = 0;
        if (IsPrime(i)) {               //如果是素数进入判断
            int x = i;
            int k = 1;
            int t;
            //判断每位是否为素数
            while (x != 0) {
                t = x % 10;
                x = x / 10;
                if (IsPrime(t) == 0)k = 0;
            }
            if (k == 0)continue;
            out = sum(i);
            //判断每位之和是不是素数
            if (IsPrime(out)) {
                printf("%dn", i);
            }
        }
    }
}
//计算每位之和的函数
int sum(int x) {
    int out=0;
    int i = 0;
    while (x != 0) {
        i = x % 10;
        x = x / 10;
        out += i;
    }
    return out;
}
//判断是否为素数的函数
int IsPrime(int value) {
    if (value <= 1)return 0;
    for (int i = 2; i <= sqrt(value); i++) {
        if (value % i == 0)return 0;
    }
    return 1;
}

吾辈名为秋月琥珀,今后也请多多关照了