题目内容

民族文化遗产包括()和()。

查看答案
更多问题

把加强基础教育放在重要位置,扎扎实实实现()是今后一个时期教育发展“重中之重”的任务。

Some people believe private cars should be banned from downtown areas. Do you agree or disagree? Use reasons and examples to explain your choice.

There is a plan to hold the Olympics near your town. Do you support or oppose this idea? Use reasons and examples to explain your choice.

字符串str由数字字符‘0’和‘1’组成(长度不超过8个字符),可看作二进制数,请补充函数fun(),该函数的功能是:把str字符串转换成十进制数,结果由函数返回。例如,输入“1001”,结果输出:9。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
include<stdio.h>
include<stdlib.h>
include<string.h>
int fun(char *str)
{
int n;
char *p=str;
【 】;
p++;
while (*p)
{
n=【 】;
p++;
}
return【 】;
}
main()
{
char str[9];
int i;
int n;
printf ("Enter a string made up of '0' and
'1' digital character:");
gets (str);
if (strlen(str)>8)
{
printf ("Error:string too longer!
please input again !\n\n");
exit(0);
}
for(i=0;str[i];i++)
if(str[i]<'0'||str[i]>'1')
{
printf("Error:%c not is '0'and
'1' digital character !\n\n",
str[i]);
exit(0);
}
printf("The original string:");
puts(str);
n=fun(str);
printf("\n%s is convered to decimal
number:%d\n\n",str,n);
}

答案查题题库