![](https://static.youtibao.com/asksite/comm/h5/images/m_q_title.png)
[主观题]
以下程序的功能是:将无符号八进制数字构成的字符串转换为十进制整数。例如,输入的字符串为556,则输出十进制
整数366。请填空。
#include<stdio.h>
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);
}
查看答案
![](https://static.youtibao.com/asksite/comm/h5/images/solist_ts.png)
#include<stdio.h>
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);
}
已知程序中定义了以下两个变量:
OCT: DB 123Q
DIG: DS 3
试编写一个程序段,将变量OCT中的三位八进制数字转换成对应的ASCII码字符后,放到变量DIG中(低位数字在前)。
A.程序的命名有意义
B.不能用数字“01”
C.不应该包含代表分析师姓名缩写的“WM”
D.不应该用""_""特符号