C语言问题求解答帮助!

请编写函数long fun(long int x),功能是:将长整型数x中每一位上为奇数的数依次取出,并逆序构成一个新数返回。例如:程序运行时输入123456789,输出:b=97531。
#include
long fun(long int x)
{
}
int main()
{long a,b;
printf("Please input a long int num:");
scanf("%ld",&a);
b=fun(a);
printf("b=%ld\n",b);
return 0;
}
编写函数void fun(char *str),将参数字符串中各单词首字母变大写,其余字母变小写。输入输出在main中实现。如输入"you HAVE 10 books,don't you? " 输出"You Have 10 Books,Don't You?"。单词以空格、逗号、句号分隔。
#include
void fun(char *str)
{
}
int main()
{char a[100];
gets(a);
fun(a);
puts(a);
return 0;
}

改成这样:

 #include<stdio.h>
long fun(long int x)
{
    long b = 0;
    while (x>0)
    {
        if ((x % 10) % 2)
            b = b * 10 + x % 10;
        x /= 10;
    }
    return b;
}
int main()
{
    long a, b;
    printf("Please input a long int num:");
    scanf("%ld", &a);
    b = fun(a);
    printf("b=%ld\n", b);
    return 0;
}

首字母变大写:

 void fun(char *str)
{
    char c = *str;
    if(c<='z' && c>='a')  //把第一个字母变大写
    {
        c = c - 32;
        *str = c;
    }

    c = *(str+1);
    while(c!='\0')
    {
        char c1 = *str;
        if((c<='z' && c>='a') && (c1==' ' || c1==',' || c1=='.'))
        {
            c = c - 32;
            *(str+1) = c;
        }
        str = str+1;
        c = *(str+1);
    }
}
int main()
{
    char a[100];
    gets(a);
    fun(a);
    printf("%s\n",a);
    return 0;
}