C语言
第1661题
设a,b,t为整型变量,初值为a=7,b=9,执行完语句t=(a>b)?a:b后,t的值是_____。
第1662题
执行下列语句后,b的十进制值是_____。
int x=240,y=15,b; char z='A'; b=((x && y) && (z<'a'));
第1663题
已知a=10,b=15,c=1,d=2,e=0,则表达式a*b&&c的值为_____。
第1664题
程序段:
int k=10; while(k=0) k=k-1;
循环体语句执行_____次。
第1665题
C语言中,数组名是一个不可变的_____量,不能对它进行加减和赋值运算。
第1666题
若有以下数组a,数组元素:a[0]~a[9],其值为9 4 12 8 2 10 7 5 1 3数组元素a[3]的值是_____。
第1667题
若在程序中用到"strlen()"函数时,应在程序开头写上包含命令#include "_____"。
第1668题
预处理命令行都必须以_____号开始。
第1669题
将函数funl的入口地址赋给指针变量p的语句是_____。
第1670题
设有以下共用体类型说明和变量定义,则变量d在内存所占字节数是_____。
union stud
{
short int num;
char name[8];
float score[3];
double ave;
}
d,stu[3];
第1671题
功能:根据整型形参m,计算如下公式的值:y=1/2+1/4+1/6+...+1/2m。
例如:若m=9,则应输出:1.414484。
#include<stdio.h>
double fun(int m)
{
double y=0;
int i;
for(_____1_____)
{
_____2_____
}
_____3_____
}
void main()
{
int n;
void TestFunc();
printf("Enter n:");
scanf("%d",&n);
printf("\nThe result is %1f\n",fun(n));
TestFunc();
}
void TestFunc()
{
FILE *IN,*OUT;
int s,i;
int t;
double o;
IN=fopen("in.dat","r");
if(IN==NULL)
{
printf("Read File Error");
}
OUT=fopen("out.dat","w");
if(OUT==NULL)
{
printf("Write File Error");
}
for(i=0;i<5;i++)
{
fscanf(IN,"%d",&t);
o=fun(t);
fprintf(OUT,"%lf\n",o);
}
fclose(IN);
fclose(OUT);
}
第1672题
功能:请编一个函数void fun(int tt[M][N],int pp[N]),tt指向一个M行N列的二维数组,求出二维数组每列中最大元素,并依次放入pp所指一维数组中,二维数组中的数已在主函数中赋予。
#include<conio.h>
#include<stdio.h>
#define M 3
#define N 4
void fun(int tt[M][N],int pp[N])
{
int i,j;
for(_____1_____)
{
_____2_____
for(_____3_____)
if(_____4_____)
_____5_____
}
}
void main()
{
int t[M][N]={{22,45,56,30},
{19,33,45,38},
{20,22,66,40}};
void NONO();
int p[N],i,j,k;
printf("The original data is:\n");
for(i=0;i<M;i++)
{
for(j=0;j<N;j++)
printf("%6d",t[i][j]);
printf("\n");
}
fun(t,p);
printf("\nThe result is:\n");
for(k=0;k<N;k++)
printf("%4d",p[k]);
printf("\n");
NONO();
}
void NONO()
{
int i,j, array[3][4],p[4];
FILE *rf,*wf;
rf = fopen("in.dat","r");
wf = fopen("out.dat","w");
for(i=0;i<3;i++)
for(j=0;j<4;j++)
fscanf(rf,"%d",&array[i][j]);
fun(array,p);
for(j=0;j<4;j++)
{
fprintf(wf,"%7d",p[j]);
fprintf(wf,"\n");
}
fclose(rf);
fclose(wf);
}
第1673题
一个C程序总是从_____开始执行。
第1674题
若a是int型变量,且a的初值为6,则计算表达式a+=a-=a*a后a的值为_____。
第1675题
int x=2; z=x++-1;
则x的值为_____。
第1676题
已知:
int i=8,j=10,m,n; m=++i; n=j++;
问语句执行后m=_____,n=_____。
第1677题
输入整型变量a的值:
int a;
scanf("%d",_____);
第1678题
当a=3,b=2,c=1时,执行以下程序段后a=_____。
if(a>b) a=b; if(b>c) b=c; else c=b; c=a;
第1679题
表示"x≥y≥z"的C表达式是_____。
第1680题
设x=5>1+2,x的值为_____。