填空题以下程序运行后的输出结果是______。 main () int a.b,c; a=10; b=20; c=(a%b<)||a/b>1); printf("%d %d %d n" ,a,b,c);
填空题给定程序中,函数fun的功能是:根据形参i的值返回某个函数的值。当调用正确时,程序输出:
x1=5.000000,x2=3.000000,x1*x1+x1*x2=40.000000。
注意:不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
double f1(double x)
{return x*x;}
double f2(double x,double y)
{return x*y;}
/*********found*********/
______fun(int i,double x,double y)
{if(i==1)
/*********found*********/
return ______(x);
else
/*********found*********/
return ______(x,y);
}
main()
{double x1=5,x2=3,r;
r=fun(1,x1,x2);
r+=fun(2,x1,x2);
printf("/nx1=%f,x2=%f,x1*x1+x1*x2=%f/n/n",x1,x2,r);
}
填空题以下程序段打开文件后,先利用fseek函数将文件位置指针定位在文件末尾,然后调用删函数返回当前文件位置指针的具体位置,从而确定文件长度,请填空。 FILE*myf;long fl; myf= 【15】 ("test.t","rb"); fseek(myf,(),SEEK_END);fl+ftell(myf); fclose(myf); printf("%d/n",fl);
填空题下列给定程序中,函数fun()的功能是;利用插入排序法对字符串中的字符按从小到大的顺序进行排序。插入法的基本方法是:先对字符串中的头两个元素进行排序,然后把第3个字符插入到前两个字符中,插入后前3个字符依然有序;再把第4个字符插入到前3个字符中,待排序的字符串已在主函数中赋予。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构.
试题程序:
#include <String.h>
#include <stdio.h>
#define N 80
void insert(char *aa)
{ iht i, j, n; char ch;
n=strlen (aa);
for (i=1; i<n; i++)
/**********************************/
{ c=aa[i];
j=i-1;
while ((j>=0) && (ch<aa [j] ))
{ aa [j+l]=aa[j];
j--;
}
aa [j+l]=ch;
}
}
main ( )
{ char a [N] = "QWERTYUIOPASDFGHJKIMNBVCXZ";
int i;
printf("The original string: %s/n",a);
insert (a);
printf("The string after sorting:
%s/n/n", a);
}
填空题函数fun的返回值是{{U}} 【7】 {{/U}}。
fun(char *a,char *b)
{ int num=0,n=0;
while(*(a+num)!='/0')num++;
while(b[n]){ *(a+num)=b[n];num++;n++;}
return num;
}
填空题以下程序用于计算一个英文句子中最长单词的长度。假设句子中只含有英文字母和空格,空格为单词之间的分隔符。
#include<stdio.h>
int main()
{
char*p, s[]={"I am a student"};
int max=0, t;
p=s;
while(______)
{
t=0;
while(*p!=""
p++;
}
if(max<t)
max=t;
______;
}
printf("max=%d", max);
return 0;
}
填空题以下函数的功能是求x的y次方,请填空。
double fun(double x,int y)
{int i;
double z;
for(i=1,z=x;i<y;i++)z=z*{{U}} 【12】 {{/U}};
return z;
}
填空题请补充函数fun(),该函数的功能是:把从主函数中输入的由数字字符组成的字符串转换成—个无符号长整数,并且逆序输出。结果由函数返回。 例如,输入: 1 2 3 4 5 6,结果输出:6 5 4 3 2 1。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。 试题程序: #include<conio.h> #include<stdio.h> #include<string.h> unsigned long fun(char *s) unsigned long t=0; int k; int i=0; i=strlen(s); for( 【1】 ;i>=0;i--) k= 【2】 ; t= 【3】 ; return t; main() char str[8]; clrscr(); printf("Enter a string made up of'0'to '9'digital character:/n"); gets(str); printf("The string iS:%S/n",str); if(strlen(str)>8) printf("The string is too long!"); else printf("The result:%lu/n", fun(str));
填空题给定程序中函数fun的功能是:从s所指字符串中删除所有小写字母c。
请改正程序中的错误,使它能计算出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
给定源程序:
#include<stdio.h>
void fun(char*s)
{int i,j;
for(i=j=0;s[i]!="/0":i++)
if(s[i]!="c")
/************found************/
s[j]=s[i];
/************found************/
s[i]=/0";
}
main()
{char s[80];
printf("Enter a string: ");gets(s);
printf("The original string: ");puts(s);
fun(s);
printf("The string after deleted:");
puts(s);printf("/n/n");
}
填空题程序通过定义学生结构体变量,存储学生的学号、姓名和三门课的成绩。函数fun的功能是:将形参a所指结构体变量中的数据赋给函数中的结构体变量b,并修改b中的学号和姓名,最后输出修改后的数据。
例如,a所指变量中的学号、姓名和三门课的成绩依次是:10001、“ZhangSan”、95、80、88,则修改后输出b中的数据应为:10002、“LiSi”、95、80、88。
请在下划线处填入正确的内容并将下划线删除,使程序得出正确的结果。
注意:部分源程序给出如下。
不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
#include<string.h>
struct student{
long sno;
char name[10];
float score[3];
};
void fun(struct student a)
{
struct student b; int i;
/**********found**********/
b=______;
b.sno=10002;
/**********found**********/
strcpy(______, "LiSi");
printf("/nThe data after modified:/n");
printf("/nNo:%ld Name:%s/nScores:", b.sno, b.name);
for(i=0; i<3; i++)
/**********found**********/
printf("%6.2f", b______);
printf("/n");
}
main()
{struct student s={10001, "ZhangSan", 95, 80, 88};
int i;
printf("/n/nThe original data:/n");
printf("/nNo:%ld Name:%s/nScores:", s.sno, s.name);
for(i=0; i<3; i++)
printf("%6.2f", s.score[i]);
printf("/n")"
fun(s);
}
填空题有以下程序
#include
main ()
{ int i, sum = 0;
for (i = 1; i < 9; i += 2) sum += i;
printf("%d\n", sum);
}
程序运行后的输出结果是U [9] /U。
填空题给定程序的主函数中,已给出由结构体构成的链表结点a、b、c,各结点的数据域中均存入字符,函数fun()的作用是:将a、b、c三个结点链接成一个单向链表,并输出链表结点中的数据。
请在程序的下画线处填入正确的内容并把下画线删除,使程序得出正确的结果。
注意:不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdio.h>
typedef struct list
{char data;
struct list *next;
}Q;
void fun(Q *pa,Q *pb,Q *pc)
{Q*p;
/*********found*********/
pa->next=______;
pb->next=pc;
p=pa;
while(p)
{
/*********found*********/
printf("%c",______);
/*********found*********/
p=______;
}
printf("/n");
}
main()
{Q a,b,c;
a.data="E";b.data="F";
c.data="G";c.next=NULL;
fun(
}
填空题有以下程序 #define f(x) x*x main() int i; i=f(6+6)/f(2+2); printf("%d/n",i); 执行后的输出结果是______。
填空题以下程序运行后的输出结果是{{U}} {{/U}}。 #include <stdio.h> main() char m; m='B'+32; printf("%c//n",m);
填空题数据库管理系统是位于用户与______之间的软件系统。
填空题下面程序是计算100以内能被4整除且个位数为4的所有整数,请填空。 main() int m,n; for(m=0;______;m++) n=m*10+4; if(______)Continue; printf("%d/n",n);
填空题黑盒测试是从 【1】 观点的测试。
填空题下列给定程序中,函数fun的功能是:依次取出字符串中所有的数字字符,形成新的字符串,并取代原字符串。
请改正程序中的锴误,使它能得出正确的结果。
注意
:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdlib,h>
#include<stdio.h>
#include<conio.h>
void fun(char *s)
{
int i,j;
for(i=0,j=0;s[i]!="/0";i++)
if(s[i]>="0"
/********found********/
s[j]="/0";
}
void main()
{
char item[80];
system("CL5");
printf("/nEnter a string:");
gets(item);
printf("/n/nThe string is:%s/n",item);
fun(item);
printf("/n/nThe string of changing is:%s/n",item);
}
填空题请补充main()函数,该函数的功能是:计算每个学生成绩的平均分,并把结果保存在数组aver中。
例如,当score[N][M]={{83.5, 82, 86, 65, 67}, {80, 91.5, 84, 99, 95}, {90.5, 95, 86, 95, 97}}时,3个学生的平均分为76.7 89.9 92.7。
注意:部分源程序给出如下。
请勿改动main()函数和其他函数中的任何内容,仅在main()函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdlib.h>
#include<stdio.h>
#define N 3
#define M 5
void main()
{
int i, j;
static float score[N][M]={{83.5, 82, 86, 65, 67}, {80, 91.5, 84, 99, 95}, {90.5, 95,86, 95, 97}};
float aver[N];
system("CLS");
for(i=0; i<N; i++)
______;
for(i=0; i<N; i++)
{
for(j=0; j<M; j++)
______;
aver[i]/=M;
}
for(i=0; i
printf("/nstudent%d/taverage=%5.1f, i+1, aver[i]); } aver[i]=0 aver[i]+=score[i][j][解析] 由程序中可知,数组aver中存放的是每个学生的平均成绩,其初始值应该为0,因此第一处填“aver[i]=0”;求平均成绩的算法是先将各科成绩相加放在aver中,再求其平均分,因此第二处填“aver[i]+=score[i][j]”。
填空题下列给定程序中,函数fun的功能是:求出数组中的最大数和次最大数,并把最大数和a[0]中的数对调、次最大数和a[1]中的数对调。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<conio.h>
#include<stdio.h>
#define N 20
/**********found**********/
void fun(int*a,int n);
{
int i,m,t,k;
for(i=0;i<n;i++)
{
/**********found**********/
m=0;
for(k=i+1;k<n;k++)
if(a[k]>a[m])
m=k;
t=a[i];
a[i]=a[m];
a[m]=t;
}
}
main()
{
int b[N]={11,5,12,0,3,6,9,7,10,8);
int n=10,i;
for(i=0;i<n;i++)
printf("%d",b[i]);
printf("/n");
fun(b,n);
for(i=0;i<n;i++)
printf{"%d,b[i]);
printf("/n");
}
