c primer 中 关于递归那一快看的不是太明白麻烦大家给指导下
下面是 程序#include "stdafx.h"
void to_binary (unsigned long n);
int _tmain(int argc, _TCHAR* argv[])
{
unsigned long number;
printf("enter an integer (q to quit): \n");
while (scanf("%ul", &number) == 1)
{
printf("binary an integer (q to quit): \n");
to_binary (number);
putchar('\n');
printf("enter an integer (q to quit): \n");
}
printf("done. \n");
getchar();
getchar();
getchar();
return 0;
}
void to_binary (unsigned long n)
{
int r;
r = n % 2;
if (n >= 2)
to_binary (n / 2);
putchar ('0' + r);
}
红色部分的函数不是太明白 麻烦大家给 讲解下 谢谢!最好能把红色部分的步骤给写一下谢谢