单项选择题
以下程序的功能是:给r输入数据后计算半径为r的圆面积s。
#include <stdio, h>
main( )
/* Beginning */
int r; float s;
scanf("% d", &r);
s = *Π* r*r;printf("s =%f\n",s);
程序在编译时出错,出错的原因是( )。
A.注释语句书写位置错误
B.存放圆半径的变量r不应该定义为整型
C.输出语句中格式描述符非法
D.计算圆面积的赋值语句中使用了非法变量
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有以下程序: #include <stdio.h> #include <string.h> main( ) char p[] = 'a','b','c'] ,q[10] = 'a','h','c' prinff( % d % d n , strlen (p) , strlen (q) ); 以下叙述中正确的是( )。
A.在给p和q数组赋初值时,系统会自动添加字符串结束符,故输出的长度都为3
B.由于P数组中没有字符串结束符,长度不能确定;q数组中字符串长度为3
C.由于q数组中没有字符串结束符,长度不能确定;p数组中字符长度为3
D.由于p和q数组中没有字符串结束符,故长度都不能确定
点击查看答案&解析
单项选择题
以下程序的功能是进行位运算:#include <stdio.h>main( ) unsigned char a,b; a =7∧3; b = ~4&3; printf( % d %d n ,a,b);程序运行后的输出结果是( )。
A.4 3
B.7 3
C.7 0
D.4 0
点击查看答案&解析
相关试题
有以下程序: #include <stdio, h>v...
有以下程序:#include <stdio.h>strue...
有以下程序:#include <stdlo.h>main...
有以下程序:#include <stdio, h>#i...
有以下程序:#include <stdio.h>float...