我看
20
1
1
{:9_218:}
{:5_101:}
0.10个A,逗号运算符的结果看最后一个运算表达式
1.会打印0个B,第一次判断的时候就跳出循环了
2.a,b,c
3.a=9,b=5,c=4
4.z = x>=0 ? x : -x;
5.
1
1
4
查看参考答案
jj'
10个
10个
c b a
15 4 10
z =abs(x)
if (size > 12)
{
cost *=1.05
看看
0. 10
1. 0
2. a,b,c
3. c = 10 b=5 a = 15
4. x>0?x:(-x);
5.
A.
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
B.
if (ibex > 14)
{
sheds = 3;
}
sheds = 2;
help = 2 * sheds;
C.
if (score < 0)
{
printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
#include<stdio.h>
void test00(){
int touzie = 10000;
double danlilv = 0.1;
double fuhelilv = 0.05;
int year = 0;
double sum1 = touzie;
double sum2 = touzie;
while(sum1 >= sum2){
sum1 += touzie * danlilv;
printf("第%d年,单利总金额:%.2lf\n", year, sum1);
sum2 += sum2 * fuhelilv;
printf("第%d年,复利总金额:%.2lf\n", year, sum2);
year++;
}
printf("年数:%d\n", year);
}
void test01(){
double zonge = 4000000;
double hongli = 0.08;
int year = 0;
while(zonge>=0){
zonge -= 500000;
zonge += zonge * hongli;
year++;
}
printf("年数:%d\n", year);
}
void test02(){
double pai = 0;
int fenmu = 1;
int fuhao = 1;
double weixiang = 1;
while(weixiang > 10E-8){
weixiang = (double)1.0 / fenmu;
pai += weixiang * fuhao;
fuhao = -fuhao;
fenmu += 2;
}
printf("pai的值为:%.10lf\n", pai*4);
}
void test03(){
int sum = 2;
for(int i=0; i<24; i++){
sum *=2;
}
printf("sum的值为:%d\n", sum);
}
int main(){
//test00();
//test01();
//test02();
test03();
return 0;
}
1
1
0. 请问下边代码将打印多少个 'A'
i (0~9) j (0~9)
100次(外层10次 * 内层10次)
1. 请问下边代码会打印多少个 'B'
i (0~10)
11次 (goto条件i>10)
2. 请写出表达式 a = b = c = 5 中的"l-value"?
a=(b=(c=5)); 赋值(=)是右结合性 a是最后的左值
3. 请问表达式 a = (b = 3, 4, c = b++ + 5, ++c + ++b); 执行后,整型变量 a、b、c 的值是?
b=3 c=b++ +5
c = 8 (3+5) b = 4 (3+1)
(c+1) + (b+1)
a = 14 (9+5)
4. 请使用条件运算符求出变量 x 的绝对值,并存放到变量 z 中
z = (x > 0 ? x : -x);
5. C 语言其实在大部分情况下不使用 goto 语句也能做得很好
请尝试将下列代码段写成不带 goto 语句的版本
【1】
if (size > 12)
{
cost = cost * 1.05;
flag = 2;
}
bill = cost * flag;
【2】
if (ibex > 14)
{
sheds = 3;
help = 2 * sheds;
}
sheds = 2;
help = 2 * sheds;
【3】
do
{
scanf("%d", &score);
count++;
}
while(score > 0)
printf("count = %d\n", count);