填空题若有以下程序
main( )
{ int a[4][4]={{1,2,-3,-4},{0,-12,-13,14} ,{-21,23,0,-24},{-31,32,-33,0}};
int i,j,s=0;
for(i=0;i<4;i++)
{ for(j=0;j<4;j++)
{ if(a[i][j]<0) continue;
if(a[i][j]==0) break;
s+=a[i][j];
}
}
printf("%d/n",s);
}
执行后输出结果是【 】。
填空题下面程序的功能是输出数组中最大的数,由a指针指向该元素。请填空。
main()
{int s[]={6,7,2,13,9,1,12,10,5,8,4,3,11},*a,*b;
for(b=s,a=s;b-s<13;b++)
if({{U}} 【6】 {{/U}})a=b;
printf("%d",*a) ; }
填空题56. 下面程序的功能:输出100以内能被3整除且个位数为6的所有整数,请填空。 # include<stdio. h> main() int i, j; for(i=0; i<10或i<=9; i++) j=i*10+6; if({{U}} {{/U}})continue; printf("% d", j);
填空题有以下定义和语句,则sizeof(a)的值是______,而sizeof(a.share)的值是______。
struct date{int day;
int month;
int year;
union
{ int share 1;
float share2;
} share;
}a;
填空题以下程序的输出结果是______。 fun (int x, int y, int z) z=x*x+y*y; main() int a=31; fun (6, 3, a) printf("%d", a)
填空题请补充函数fun(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。
例如:str1=“How do”,str2=“you do?”,结果输出:How do you do?
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define N 40
void fun(char *str1,char *str2)
{
int i=0;
char *p1=str1;
char *p2=str2;
while({{U}} 【1】 {{/U}})
i++;
for( ;{{U}} 【2】 {{/U}};i++)
*(p1+i)={{U}} 【3】 {{/U}};
*(p1+i)='/0';
}
main()
{
char str1[N],str2[N);
clrscr();
printf("*****Input the string str1 & str2*****/n");
printf("/nstr1:");
gets(str1);
printf("/nstr2:");
gets(str2);
printf("**The string str1 & str2**/n");
puts(str1);
puts(str2);
fun(str1,str2);
printf("*****The new string *****/n");
puts(str1);
}
填空题请补充main函数,该函数的功能是:输入两个正整数m和n,求这两个数的最大公约和最小公倍数。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include <stdio.h>
main ( )
{
int a, b, n, m, t;
clrscr ();
printf ("/nInput two numbers: /n");
scanf ("%d, %d",
if (n<m)
{
a=m;
b=n;
}
else
{
a=n;
b=m;
}
while({{U}} 【1】 {{/U}})
{
t={{U}} 【2】 {{/U}}
a=b;
b=t;
}
printf ("greatest con. non divisor:
%d/n", a);
printf ("least common multiple:
%d/n",{{U}} 【3】 {{/U}});
}
填空题若输入21、23、34、11、2、6,则以下程序的运行结果 【9】 。main() int i; char+p,num[6]; for (i=0;i<5;i++) scanf("%d,",&num[i]); scanf("%d",&num[5]); p=&num[0]; sort(p,6); for (i=0;i<5;i++) printf("%d,",num[i]); printf("%d/n",num[5]);sort(p,m)char*p;int m; int i; char change,*p1,*p2; for (i=0;i<m/2;i++) p1=p+i; p2=p+(m-1-i); change=*p1; *p1=*p2; *p2=change;
填空题以下程序中,函数SumColumMin的功能是:求出M行N列二维数组每列元素中的最小值,并计算它们的和值。和值通过形参传回主函数输出。请填空。 #define M 2 #define N 4 void SumColumMin(int a[M][N],int *sum) int i,j,k,s=0; for(i=0;i<N;i++) k=0; for(j=1;j<M;j++) if(a[k][i]>a[j][i])k=j; s+= 【18】 ; 【19】 =s; main() int x[M][N]=3,2,5,1,4,1,8,3,s; SumColumMin( 【20】 ); printf("%d/n",s);
填空题以下程序运行后的输出结果是{{U}}【9】{{/U}}。
main( )
{ int x=15;
while(x>10 &&x<50)
{ x++;
if(x/3){ x++;break;}
else continue;
}
printf("%d/n",x);
}
填空题已有定义:char c=' ';int a=1,b;(此处c的初值为空格字符),执行b=!c后b的值为______。
填空题在关系模型中,把数据看成是二维表,每一个二维表称为一个 【3】 。
填空题请补充函数fun(),该函数的功能求能整除x且是偶数的数,把这些数保存在数组bb中,并按从大到小的顺序输出。
例如当x=20时,依次输出:20 10 4 2。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<conio.h>
#include<stdio.h>
void fun(int k,int bb[ ])
{
int i;
int j=0;
for({{U}} 【l】 {{/U}};i<=k;i++)
{
if({{U}} 【2】 {{/U}})
bb[i++]=i;
}
printf("/n/n");
for(i={{U}} 【3】 {{/U}};i>=0;i--)
printf("%d",bb[i]);
}
main( )
{
int k=1;
int bb[100];
clrscr( );
printf("/nPlease input X=");
scanf("%d",&k);
fun(k,bb);
}
填空题请补充函数proc(),该函数的功能是:只保留字符串中的大写字母,删除其他字符,结果仍保存在原来的字符串中,由全局变量m对删除后字符串的长度进行保存。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdlib.h>
#include<conio.h>
int m;
void proc(char*str)
{
int i=0, j=0;
char*p=str;
while(*(p+i))
{
if(*(p+i)>="A"
}
______;
}
str[j]="/0";
______;
}
void main()
{
char str[80];
system("CLS");
printf("/nEnter a string: ");
gets(str);
printf("/n/nThe string is: %s/n", str);
proc(str);
printf("/n/nThe string of changing is: %s/n", str);
printf("/n/nThe length of changed string is: %d/n", m);
}
填空题表达式1/2*(int)3.7/(int)(2.4*(1.5+2.5))值的数据类型为______。
填空题函数pi的功能是根据以下近似公式求π值: (π*π)/6=1+1/(2*2)+1/(3*3)+…+1/(n*n) 现在请你在下面的函数中填空,完成求丌的功能。 #include<math.h> double pi(10ng n) double s=0.0; long i; for(i=1; i<=n; i++)s=s+______; return(sqrt(6*s));
填空题有以下程序
#include
#include
void fun(char *str)
{ char temp;int n,i;
n=strlen(str);
temp=str[n-1];
for(i=n-1;i>0;i--) str[i]=str[i-1];
str[0]=temp;
}
main()
{ char s[50];
scanf("%s",s); fun(s); printf("%s/n",s);}
程序运行后输入:abcdef,则输出结果是 【 】 。
填空题请补充函数fun(),该函数的功能是:计算下面公式的值(k<50):例如:当k=5时,s=338.215158。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数函数fun()的横线上填入所编写的若干表达式或语句。试题程序:#include<conio.h>#include<stdio.h>doublefun(intn){doubles={{U}}【1】{{/U}};doublef=0.0;doublep=0.0;inti=0;intk;for(k=1;{{U}}【2】{{/U}};k++){f=2*k-1;p=2*k+l;for(i=1;i<2*k+l;i++)f*=2*k-1;for(i=1;i<2*k-1;i++)p*=2*k+1;{{U}}【3】{{/U}};}returns;}main(){intk=0;doubles;clrscr();printf("/nPleaseinputk(k<50):");scanf("%d",&k);s=fun(k);printf("/nS=%lf",s);}
填空题在C语言中,当表达式值为0时表示逻辑值“假”,当表达式值为 (8) 时表示逻辑值“真”。
填空题有以下程序
#include
main()
{ int a[]={1,2,3,4,5,6},*k[3],i=0;
while(i<3)
{ k[i]=
printf("%d",*k[i]);
i++;
}
}
程序运行后的输出结果是 【 】 。
