C语言 求大神拯救

根据下列要求,完成程序
1从键盘输入一个三位数整数,并输出该整数,同时输出该三位整数的每一位数字
2写一个函数,判断该三位整数是否为水仙花数
3以该整数的三位数字作为一元二次方程的系数,求该一元二次方程的根
4定义该整形数组,包含十个数据,把该整数的三位数字。依次放入该数组的最前三位,并把数组内容补充完整。并对该数组进行排序,分别输出该数组排序前和排序后的顺序
5对4中做好的数组进行排序(算法不和4相同)输出。(限用指针实现)

 153
153, 1 5 3.
yes
x1=-0.697224 x2=-4.302776
3 5 1 1 3 5 7 2 4 6
1 1 2 3 3 4 5 5 6 7
3 5 1 1 3 5 7 2 4 6
1 1 2 3 3 4 5 5 6 7
Press any key to continue
 179
179, 1 7 9.
no
x1=-1.697224 x2=-5.302776
9 7 1 1 3 5 7 2 4 6
1 1 2 3 4 5 6 7 7 9
9 7 1 1 3 5 7 2 4 6
1 1 2 3 4 5 6 7 7 9
Press any key to continue
 #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <memory.h>
int foo(int x, int a, int b, int c)
{
    int aa, bb, cc;
    aa = a, bb = b, cc = c;
    for (int i = 1; i < 3; i++)
    {
        aa *= a;
        bb *= b;
        cc *= c;
    }
    return aa + bb + cc == x ? -1 : 0;
}

int cmp(const void * a, const void * b)
{
    return *(int *)a - *(int *)b;
}

int main()
{
    int n;
    scanf("%d", &n);
    int a = n % 10;
    n /= 10;
    int b = n % 10;
    n /= 10;
    int c = n % 10;
    printf("%d, %d %d %d.\n", c * 100 + b * 10 + a, c, b, a);
    if (foo(c * 100 + b * 10 + a, c, b, a))
        printf("yes\n");
    else
        printf("no\n");
    double x1 = (-b + sqrt(b * b - 4 * a * c)) / (2 * c);
    double x2 = (-b - sqrt(b * b - 4 * a * c)) / (2 * c);
    printf("x1=%lf x2=%lf\n", x1, x2);
    int data[] = { a, b, c, 1, 3, 5, 7, 2, 4, 6 };
    int i;
    for (i = 0; i < 10; i++)
        printf("%d ", data[i]);
    printf("\n");
    int s[10];
    memcpy(&s[0], &data[0], sizeof(int) * 10);
    qsort(s, 10, sizeof(int), cmp);
    for (i = 0; i < 10; i++)
        printf("%d ", s[i]);
    printf("\n");
    memcpy(&s[0], &data[0], sizeof(int) * 10);
    for (i = 0; i < 10; i++)
        printf("%d ", s[i]);
    printf("\n");
    int j;
    for (i = 0; i < 10; i++)
        for (j = 1; j < 10 - i; j++)
        {
            if (s[j - 1] > s[j])
            {
                int t = s[j - 1];
                s[j - 1] = s[j];
                s[j] = t;
            }
        }
    for (i = 0; i < 10; i++)
        printf("%d ", s[i]);
    printf("\n");
    return 0;
}