输入12345,逆序输出--简单

//

//  main.cpp

//  numtochar

//

//  Created by duanqibo on 2019/10/15.

//  Copyright © 2019年 duanqibo. All rights reserved.

//

#include <iostream>

#define N 80

char s[N];

void fun(long int n)

{

    int i=0;

    while(n>0)

    {

        s[i]=n%10+'0';

        n=n/10;

        i++;

    }

    s[i]='';

}

int main(int argc, const char * argv[]) {

    long int n=12345;

    printf("***asdfasfaf***");

    printf("n=%ld",n);

    fun(n);

    printf(" %s",s);

    

}

原文地址:https://www.cnblogs.com/duanqibo/p/11692957.html