有以下程序:#include<stdio.h>main(){int s=0,a=1,n; scanf("%d",&n); do {s+=1;a=a-2;} whi
有以下程序: #include <stdio.h> main() { int s=0,a=1,n; scanf("%d",&n); do {s+=1;a=a-2;} while(a!=n); printf("%d\n",s); } 若要使程序的输出值为2,则应该从键盘给n输入的值是()。
A.-1
B.-3
C.-5
D.0
有以下程序: #include <stdio.h> main() { int s=0,a=1,n; scanf("%d",&n); do {s+=1;a=a-2;} while(a!=n); printf("%d\n",s); } 若要使程序的输出值为2,则应该从键盘给n输入的值是()。
A.-1
B.-3
C.-5
D.0
有以下程序:#include <stdio, h>void sum(int a[ ] ){ a[0]=a[-1] +a[1];}main (){ int a[10] = {1,2,3,4,5,6,7,8,9,10}; sum(&a[2]); prinff("% d \n",a[2]); }程序运行后的输出结果是()。
A.6
B.7
C.5
D.8
有以下程序: #include <stdio, h> main() { int m =0256,n =256; printf("% o % o \n" ,m,n); 程序运行后的输出结果是() 。
A.0256 0400
B.0256 256
C.256 400
D.400 400
有以下程序:#include <stdio, h>main(){ char a1 ='M',a2 ='m'; printf("%c\n",(a1,a2)); } 以下叙述中正确的是()。
A.程序输出大写字母M
B.程序输出小写字母m
C.格式说明符不足,编译出错
D.程序运行时产生出错信息
有以下程序: #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> main() {int a=200; #define a 100 printf("%d",a) ; #undefa printf("%d",a) ; }
A.200 100
B.100 100
C.100 200
D.200 200
有以下程序: #include <stdio, h>void swap1 (int c0[],int e1[] ){ int t; t = c0[0]; c0[0]: c1 [0] ; c1 [0] = t;}void swap2(int * c0,int * c1){ int t; t= *c0; *c0= *c1; * c1 =t;}main(){ inta[2]={3.5}.b[2]={3,5}; swapl(a,a+1) ;swap2(&b[0],&b[1]); printf("% d %a %d %d \n" ,a[0] ,a[1] ,b[0] ,b[1] ); }程序运行后的车出结果是()。
A.3 5 5 3
B.5 3 3 5
C.3 5 3 5
D.5 3 5 3
下列程序的执行结果是()。
#include<stdio h>
main
{ int a,b,c;
a=b=2,c=I;
c=(a++)-1;printf("%d,0Ad",a,c);
c+=-a+++(b);printf("%d,%d",a,c);
)
A.3,14,1
B.3,14,2
C.2,04,1
D.2,14,1
请编写函数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);
}
有以下程序
#include <stdio.h>
#include <string.h>
main()
{ printf("%d\n",strlen ("ATS\n012\1") ); }
程序运行后的输出结果是
A)3
B)8
C)4
D)9