A.1 2
B.2 1
C.1 1
D.2 2
第1题
#include <stdio.h>
#define PT 3.5;
#define S(x) PT*x*x;
main()
{ int a=1, b=2; printf(“%4.1f\n”,S(a+b));}
程序运行后输出的结果是
A)14.0 B)31.5 C)7.5 D)程序有错无输出结果
第2题
A.6
B.7
C.8
D.9
第3题
include<stdio.h>
define PT 5.5
define S(x)PT*x*X
main
{ int a=1,b=2:
printf("%4.1f\n",s(a+b));
}
A.49.5
B.9.5
C.22.0
D.45.0
第4题
A.12.0
B.9.5
C.12.5
D.33.5
第5题
A.49.5
B.9.5
C.22.0
D.45.0
第6题
第7题
#define PT 5.5
#define S(x) PT*x*x
#include<stdio.h>
main()
{ int a=1,b=2;
printf("%4.1f\n",S(a+b));}
A.49.5
B.9.5
C.22
D.45
第8题
#define PT 5.5
#define S(x) PT*x*x
#include<stdio.h>
main()
{ int a=1,b=2;
printf("%4.1f\n",S(a+b));}
A.49.5
B.9.5
C.22
D.45
第9题
以下程序运行后,输出结果是( )。
#include<stdio.h>
#define PT 5.5
#define S(x)PT*x*X
main
{ int a=1,b=2:
printf("%4.1f\n",s(a+b));
}
A.49.5
B.9.5
C.22.0
D.45.0
【我提交的答案】: |
【参考答案与解析】: 正确答案:B |
本题考查函数调用,由于a+b没有被括起来,所以s(a+b)=PT*a+b*a+b=5.5*1+2*1+2 =9.5,故选择B。
第10题
以下程序的功能是计算一元二次方程的根。代码如下,请将第10行标号处缺少的语句填写完整。#include <stdio.h> #include <stdlib.h> #include <math.h> #define EPS 1e-6 int main() { float a, b, c, disc, p, q; printf("Please enter the coefficients a,b,c:"); scanf("%f,%f,%f", &a, &b, &c); _________________________________ /* a=0时,输出"不是二次方程" */ { printf("It is not a quadratic equation!\n"); exit(0); /* C标准库函数,用于终止整个程序的执行,强制返回操作系统 */ } disc = b * b - 4 * a * c; /* 计算判别式 */ p = - b / (2 * a); q = sqrt(fabs(disc)) / (2 * a); if (fabs(disc) <= eps) * 判别式等于0时,输出两相等实根 { printf("x1="x2" %.2f\n", p); } else if (disc> EPS) /* 判别式大于0时,输出两不等实根 */ { printf("x1 = %.2f, x2 = %.2f\n", p+q, p-q); } else /* 判别式小于0时,输出两共轭复根 */ { printf("x1 = %.2f+%.2fi, ", p, q); printf("x2 = %.2f-%.2fi\n", p, q); } } return 0; }
A、if (fabs(a) <= eps)> B、if (a <= eps)> C、if (a=0)
D、if (a<= eps || a>=-EPS)
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!