以下程序:#include<stdio.h>#include<string.h>main(){char str[]="abcd\n\123\xab";printf("%d"
以下程序: #include<stdio.h> #include<string.h> main() {char str[]="abcd\n\123\xab"; printf("%d",(str)); } 运行后的输出结果是()。
A.10
B.9
C.7
D.14
以下程序: #include<stdio.h> #include<string.h> main() {char str[]="abcd\n\123\xab"; printf("%d",(str)); } 运行后的输出结果是()。
A.10
B.9
C.7
D.14
以下程序打开新文件f.txt,并调用字符输出函数将a数组中的字符写入其中,请填空。
include<stdio.h>
main()
{________*fp;
char a[5]=(’1’,’2’,’3’,’4’,’5’),i;
fp=fopen(”f.txt”,”w”);
for(i=0;i<5;i++)fputc(a[i],fp);
fclose(fp);
}
请编写函数fun(),该函数的功能是:计算并输出
S=1+(1+20.5)+(1+20.5+30.5)+…+(1+20.5+30.5+…+n0.5)
例如,若主函数从键盘给n输入20后,则输出为
s=534.188884。
注意;部分源程序给出如下。
请勿改动主函数main 和其他函数中的任何内容,仅在函数fun 的花括号中填入所编写的若干语句。
试题程序:
include <math. h>
include <stdio. h>
double fun(int n)
{
}
main()
{
int n;
double s;
printf("\n\nInput n: ");
scanf ("%d", &n);
s=fun (n)
printf ("\n\ns=%f\n\n", s);
}
请编写函数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>
#include<string.h>
main()
{char a[10]=”abcd”;
prinff(“%d,%d\n”,strlen(A),sizeof(A));
}
程序运行后的输出结果是
A.7,4
B.4,10
C.8,8
D.10,lO
有以下程序 #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.b> void fun(char c) { if(c>X)fun(c-1): printf("%C",c); } traia() { fun(z);} 程序运行后的输出结果是()
A.xyz
B.wxyz
C.xzy
D.zvx
有以下程序: include<stclio.h> main() { char c; while((c=getchar())!=?)putchar(--c); } 程序运行时,如果从键盘输入:Y?N?<回车>,则输出结果为【 】。
有以下程序
#include <stdio.h>
main()
{ char a,b,c;
b=’1’; c=’A’;
for(a=0; a<6; a++)
{ if (a%2) putchar(b+a);
else putchar(c+a);
}
}
程序运行后的输出结果是
A) 1B3D5F
B) ABCDEF
C) A2C4E6
D) 123456
有以下程序: #include <stdio.h> main() { int a [10]={1,2,3,4,5,6,7,8,9,10},*p=&a[3], *q=p+2; prinff("%d\n";*p+*q); } 程序运行后的输出结果是()。
A.16
B.10
C.8
D.6
有以下程序: #include<stdio.h> void func(int n) { int i; for(i=0;i<=n;i++)printf("*"): printf("#"); } main() {func(3);printf("????");func(4);printf("n\"); 程序运行后的输出结果()。
A.****#????***#
B.***#????****#
C.**#????****#
D.****#????*****#