有下列程序: include<stdio_h> deftneN5 defineMN+1 definefix)(x*M) main() {inti1,i
有下列程序: include<stdio_h> deftneN5 defineMN+1 definefix)(x*M) main() {inti1,i2; i1=f(2); i2=f(1+1); printf(%d%d\n,il,i2); } 程序的运行结果是
A.127
B.1212
C.1111
D.117
有下列程序: include<stdio_h> deftneN5 defineMN+1 definefix)(x*M) main() {inti1,i2; i1=f(2); i2=f(1+1); printf(%d%d\n,il,i2); } 程序的运行结果是
A.127
B.1212
C.1111
D.117
有以下程序: #include <stdio, h>int a =2;int f(int n){ static int a: 3; int t=0; if(n%2){ static int a=4;t+ =a++;} else { static int a=5;t+ :a++;} return t + a + +;main (){ int s=a,i; for(i=0;i<3;i++)s + =f(i); prinff("% d \n" ,s); }程序运行后的输出结果是()。
A.26
B.28
C.29
D.24
以下程序运行后的输出结果是【 】。 include <stdio, h> main() char c1 ,c2; for(el = 0, c2 =9; e1<c2; c1 + + , c2 -- ) printf(" %c%c", c1, c2 ); printf("\n" ); }
下面程序的功能是将小写字母变成对应大写字母后的第二个字母。其中y变成A,z变成B。
#include "stdio.h"
main()
{char c;
while((c=getchar())!='\n')
{if(c>='a'&&c<='z')
c=c-30;
if(c>'z'||c<='z'+2)
c=c-26;}
printf("%c",c);
}
错误:______
改正:______
参考答案:错误
A.注释语句书写位置错误
B.存放圆半径的变量r不应该定义为整型
C.输出语句中格式描述符非法
D.计算圆面积的赋值语句中使用了非法变量
请编写函数fun(),其功能是:将s所指字符串中下标为偶数的字符删除,串中剩余字符形成的新串放在t所指数组中。
例如,当s所指字符串中的内容为ABCDEFGHIJK,则在t所指数组中的内容应是BDFHJ。
注意:部分源程序给出如下。
请勿改动主函数main口其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include<conio. h>
include<stdio .h>
include<string.h>
void fun(char *s,char t[])
{
}
main ()
char s[l00] ,t[l00];
clrscr ();
printf("%nPlease enter string S: ");
scanf("%s ",s);
fun(s,t);
prlntf("\nThe result is:%s\n ",t);
}
请补充main函数,该函数的功能是:打印届1~1000中满足:个位数字的立方等于其本身所有数。
本题的结果为;1 64 125 216 729
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数main的横线上填入所编写的若干表达式或语句。
试题程序:
include <stdio .h>
main ()
{
int i,g;
clrscr ();
for (i=1; i<1000; i++)
{
g=【 】;
if(【 】)
printf ("%4d", i);
}
}