有以下程序#include<stdio.h>main(){int x=011;printf(“%d\n”,++x);}程序运行后的输出结果是
A.12
B.11
C.10
D.9
A.12
B.11
C.10
D.9
有以下程序: #include < stdio. h > main () int a=3,b=4,c=5,d=2; if(a>b) if(b>c)printf("%d",d++ +1); else printf("% d", + + d + 1 ); printf("% d \n" ,d); 程序运行后的输出结果是()。
A.2
B.3
C.43
D.44
有以下程序#include<stdio. h>main(){ char c1='1',c2='2'; c1=getchar(); c2=getchar(); putchar(c1); putchar(c2);} 当运行时输入:a<回车> 后,以下叙述正确的是
A.变量c1被赋予字符a,c2被赋予回车符
B.程序将等待用户输入第2个字符
C.变量c1被赋予字符a,c2中仍是原有字符2
D.变量c1被赋予字符a,c2中将无确定值
A.=0
B.=1
C.=2
D.=3
下列给定程序中,函数fun()的功能是;计算函数 F(x, y ,z)=(x+ y)/(x-y)+(z+ y)/(z-y)的值。其中x和y不相等,z和y不等。例如,当x的值为9,y的值为11,2的值为15时,函数值为-3.50。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main 函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include <stdio. h>
include <math. h>
/**************found******************/
define FU(m, n) (m/n)
float fun(float a, float b, float c)
{ float value;
value=FU(a+ b, a-b)+FU(c+ b, c-b);
/*************found******************/
return(Value);
}
main()
{ float x, y, z, sum;
printf ("Input x y z:: ");
scanf("%f%f%f", &x, &y, &z);
printf("x=%f, y=%f, z=%f\n ",x, y, z);
if (x==y||y==z) {printf ("Data error! \n ");
exit (0); }
sum=fun (x, y, z);
printf("The result is:%5. 2f\n ",sum);
}
请编写函数fun(),该函数的功能是:移动字符串中的内容,移动的规则是把第1到第m个字符,平移到字符串的最后,把第m+1到最后的字符移到字符串的前部。
例如,字符串中原有的内容为ABCDEFGHIJK,m的值为 3,移动后,字符串中的内容应该是DEFGHIJKABC。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
include <stdio. h>
include <string.h>
define N 80
void fun (char *w, int m)
{
}
main ()
{
char a[N]= "ABCDEFGHIJK";
int m;
printf ("The origina string : \n");
puts (a);
printf("\n\nEnter m: ");
scanf ("%d", &m);
fun (a, m);
printf (" \nThe string after moving : \n");
puts (a);
printf ("\n\n");
}
有以下程序 #include <stdio.h> int fun(int a, int b) { if(b==0) return a; else return(fun(-a,-b)); } main() { printf("%d\n",fun(4,2)); } 程序的运行结果是______。
A.1
B.2
C.3
D.4
有以下程序
#include<stdio.h>
#include<string.h>
main()
{char x[]=“STRING”;
x[0]=0;x[1]=’\0’;x[2]=’0’;
printf(”%d%d\n”,sizeof(x),strlen(x));
}
程序运行后的输出结果是()。
A.6 1
B.7 0
C.6 3
D.7 1