若有以下定义,则表达式“a * b + d – c”的值的类型为 #include <stdio.h> int main() { char a; int b; float c; double d; .... return 0; }
A.double
B.int
C.float
D.char
A.double
B.int
C.float
D.char
第1题
while(getchar( )!=\n); . . . } 以下叙述中正确的是( )。
A.此while语句将无限循环
B.getchar( )不可以出现在while语句的条件表达式中
C.当执行此while语句时,只有按回车键程序才能继续执行
D.当执行此while语句时,按任意键程序就能继续执行
第2题
#include<stdio.h>
main()
{
while(getchar()!=‘\n’);
}
以下叙述中正确的是
A.此while语句将无限循环
B.getchar()不可以出现在while语句的条件表达式中
C. 当执行此while语句时,只有按回车键程序才能继续执行
D.当执行此while语句时,按任意键程序就能继续执行
第3题
#include<stdio.h>
main()
{
while(getchar()!=‘\n’);
}
以下叙述中正确的是
A.此while语句将无限循环
B.getchar()不可以出现在while语句的条件表达式中
C. 当执行此while语句时,只有按回车键程序才能继续执行
D.当执行此while语句时,按任意键程序就能继续执行
第4题
#include <stdio.h>
main()
{ …
while( getchar()!='\n');
…
}
以下叙述中正确的是
A)此while语句将无限循环
B) getchar()不可以出现在while语句的条件表达式中
C)当执行此while语句时,只有按回车键程序才能继续执行
D)当执行此while语句时,按任意键程序就能继续执行
第5题
B.变量b的值
C.变量a的值
D.变量b的地址
第6题
#include "stdio.h"
typedef struct aa
{ int a;
struct aa *next; } M;
void set(M *k,int i,int *b)
{ int j,d=0;
for(j=1;j <i;j++)
{ k[j-1].next=&k[j];
k[j-1].a=b[d++]; }
k[j].a=b[d]; }
main()
{ M k[5],*p;
int d[5]={23,34,45,56,67};
set(k,5,d);
p=k+1;
printf("%d\n",table); }
则下面的表达式在table处,能使程序执行后,打印输出数据45的是
A.p->next->a
B.++p->a
C.(*p).a++
D.p++->a
第7题
例如,若输入的两个正整数为12,4,则它们的最大公约数为12,最小公倍数为4。
注意:部分源程序给出如下。
请勿改动main函数和其他函数中的任何内容,仅在main函数的横线上填人所编写的若干表达式或语句。
试题程序:
include<stdlib.h>
include<stdio.h>
void main
{
int a,b,numl,num2,t;
system("CLS"):
printf("\nInput two numbers:\n");
scanf("%d,%d",&numl,&num2);
if(numl<num2)
{
a=num2;
b=num1:
}
else
{
a=num1;
b=num2;
}
while(【1】)
{
t=【2】
a=b;
b=t:
}
printf(“greatest common divisor:
%d\n",a);
printf("least common multiple:
%d\n",【3】;
}
第8题
例如,当a=1,b=2,c=1时,方程的两个根分别是:x1 =-1.00,x2=-1.00。
注意:部分源程序给出如下。
请勿改动函数中的其他任何内容,仅在横线上填入所编写的若干表达式或语旬。
试题程序:
include<math.h》
include<stdio.h》
void main
{
double a,b,c,x1,x2,disc;
do
{
printf("Input a,b,C:");
scanf("%1f,%1f,%1f”,&a,&b,&C);
disc=b*b一4*a*C:
if(disc<0)
printf("disc=%1f\n Input again!\n",disc);
}
while(【1】);
printf("****1he result****\n");
x1=(-b+【2】 (disc))/(2*a);
x2=(-b-【3】(disc))/(2*a);
printf("\nx1=%6.21f\nx2=%6.21f\n",x1,x2);
}
第9题
第10题
下列给定程序中,函数fun()的功能是:对N名学生的学习成绩,按从高到低的顺序找出前m(m≤10)名学生来,并将这些学生数据存放在一个动态分配的连续存储区中,此存储区的首地址作为函数值返回。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<mallo
C.h>
#include<string.h>
#include<conio.h>
#define N 10
typedef struct ss
{
char num[10];
int order;
}STU;
STU *fun(STU a[], int m)
{
STU b[N],*tt;
int i,j,k;
(1) ;
for(i=0; i<N; i++)
b[i]=a[i];
for (k=0;k<m;k++)
{
for(i=j=0;i<N;i++)
if ( (2) )
j=i;
tt[k]=b[j];
b[j].order=0;
}
return (3) ;
}
outresult(STU a[],FILE *pf)
{
int i;
for(i=0;i<N; i++)
fprintf(pf,"No=%s Mark=%d\n",
a[i].num,a[i].order);
fprintf(pf,"\n\n");
}
main()
{
STU [N]={{"A01",80},{"A02",79},
{"A03",66},{"A04",82},{"A05",87},
{"A06",93},{"A07",78},{"A08",60},
{"A09",85},{"A10",73}};
STU *p_order;
int i,m;
clrscr();
printf("*** The Origial data ***\n");
outresult(a, stdout);
printf("\nGive the numeber of the
students who have better score:");
scanf("%d",&m);
while (m>10)
{
printf("\nGive the number of the
studets who have better score:");
scanf("%d",&m);
}
p_order=fun(a,m);
printf("*** THE RESULT ***\n");
printf("*** The top students ***\n");
for(i=0; i<m; i++)
printf(" %s %d\n",
p_order[i].num,p_order[i].order);
free(p_order);
}
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!