58.下面程序段在编译时不会报错的是( )。
A. #define double 2
B. #define b 2
void main()void main()
{double b=0;}{int b=0;}
C. #define b 2
D. #define b 2
void main()int x=b;
{b++;}void main()
{x++;}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-c928-c003-bc7499099f00.html
点击查看答案
11.下面程序是用递归算法求m与n的最大公约数。
设求m与n的最大公约数的函数为gcd( ),则递归公式为:
#include
int gcd( )
{int k;
if(( (30) ))
k=m;
else
k=( (31) );
return k;
}
int main()
{int m,n;
scanf( );
printf(
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f6-87b8-c003-bc7499099f00.html
点击查看答案
31.在函数说明时,下列________项是不必要的。
A. 函数名字
B. 函数参数类型和名字
C. 函数的类型
D. 返回值表达式
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-2828-c003-bc7499099f00.html
点击查看答案
6.下列程序执行时输入12345#,输出结果是________。
#include
int main()
{ char c;
for( )
putchar( );
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f1-8678-c003-bc7499099f00.html
点击查看答案
21.D22.C23.A24.B25.C26.A
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f1-5b80-c003-bc7499099f01.html
点击查看答案
17.已有定义“float m;double n;int a;long b;char c;”,则表达式m+n*a/m+b/n+c值的类型为( )。
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3ef-2ce8-c003-bc7499099f01.html
点击查看答案
12.下面程序的功能是:输出100以内(不含100)能被3整除且个位数为6的所有整数。请填空。
#include
int main()
{int i,j;
for(i=0;( (24) );i++)
{j=i*10+6;
if(( (25) ))
printf("%3d",j);
}
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f2-5198-c003-bc7499099f00.html
点击查看答案
3.编写程序,输入一个形式如“操作数 运算符 操作数”的四则运算表达式,输出运算结果。若运算符为'/'时,能处理除数为0的情况。
#include
int main( )
{ char operator; double value1, value2;
printf( );
scanf("%lf%c%lf", &value1, &operator, &value2);
switch( )
{ case '+':
printf("=%.2f\n", value1+value2); break;
case '-':
printf("=%.2f\n", value1-value2); break;
case '*':
printf("=%.2f\n", value1*value2); break;
case '/':
if(value2==0)
printf("Cannot divide into 0");
else
printf("=%.2f\n", value1/value2); break;
default:
printf( ); break;
}
return 0;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f1-6f08-c003-bc7499099f00.html
点击查看答案
14.下面程序运行时输出结果是()。
#include
int x = 1;
int main()
{int b;
b = fun(3);
printf( );
return 0;
}
int fun( )
{if(x==3){int x=2;return x; }
else return x;
}
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f5-8db8-c003-bc7499099f00.html
点击查看答案
13.已有定义“int a[3][4]={0};",则下面正确的叙述是________。
A. 只有元素a[0][0]可得到初值
B. 此说明语句不正确
C. 数组a中各元素都可得到初值,但其值不一定为0
D. 数组a中每个元素均可得到初值0
https://www.shititong.cn/cha-kan/shiti/0005e1ec-b3f2-ce98-c003-bc7499099f00.html
点击查看答案