#include <stdio.h>
#define N 100
void strcharspace(char[],char[]);
int main(int argc, char *argv[])
{
char ch1[N],ch2[N];
int number;
printf("please input 4 numbers:");
scanf("%d",&number);
strcharspace(ch1,itoa(number,ch2,10));
printf("the result is :\n");
puts(ch1);
system("pause");
return 0;
}
void strcharspace(char dest[],char src[])
{
int i,j = 0;
int str_len = strlen(src);
for (i = 0; i < str_len; i++)
{
dest[j++] = src[i];
if (i + 1 != str_len)
{
dest[j++] = ' ';
}
}
dest[j] = '\0';
}
|