关于一道填空题
将无符号的八进制数字构成的字符串转换为八进制整数。例如输入的字符串为556.则输出的十进制整数为366.#include "stdio.h"
void main()
{
char *p,s[6];
int n;
p=s;
gets(p);
n=*p-'0';
while(________!='\0')
n=n*8+*p-'0';
printf("%d\n",n);
}
知道题目的思路是什么,我摸不着头脑,有兴趣的人能分析下吗?
2012-05-22 23:26
2012-05-22 23:56