学渣小白 的学生作业:
第7行输出____0
第10行输出____1
第13行输出____0
第16行输出____0
第19行输出____1
第22行输出____0
第25行输出____1
第27行输出____0,0,1
#include
#define debug 1
#define DEBUG_PRINT(…) if(debug) printf(VA_ARGS)
int main(void) {
//DEBUG_PRINT (“Simplified debugging: temp=% d, formula calculation:% d \n”, temp, temp+10);
int value = 0;
int a = 0;
int b = 1;
int Estimate=0,Estimate_a=0,Estimate_b=0;
value = a && b;
printf("value = a && b;" "\n");
Estimate=0 ;
printf("Estimate=0 ;" "\n");
Estimate==value?printf("Great, you guessed it right!\n"):printf("Wrong, recalculate!\n");
printf("\n*************delimiter**************\n");
value = a || b;
printf("value = a || b;" "\n");
Estimate=1 ;
printf("Estimate=1 ;" "\n");
Estimate==value?printf("Great, you guessed it right!\n"):printf("Wrong, recalculate!\n");
printf("\n*************delimiter**************\n");
value = a++ && b ++;
printf("value = a || b;" "\n");
Estimate=0 ;
printf("Estimate=0 ;" "\n");
Estimate==value?printf("Great, you guessed it right!\n"):printf("Wrong, recalculate!\n");
printf("\n*************delimiter**************\n");
//a=1;b=1
value = --a || b --;
printf("value = --a || b --;" "\n");
Estimate=1 ;
printf("Estimate=1 ;" "\n");
Estimate==value?printf("Great, you guessed it right!\n"):printf("Wrong, recalculate!\n");
printf("\n*************delimiter**************\n");
//a=0;b=0
value = (a + b) || (a - b);
printf("value = (a + b) || (a - b);" "\n");
Estimate=0;
printf("Estimate=0 ;" "\n");
Estimate==value?printf("Great, you guessed it right!\n"):printf("Wrong, recalculate!\n");
printf("\n*************delimiter**************\n");
//a=0;b=0
value = (a * b) && (a + b);
printf("value = (a * b) && (a + b);" "\n");
Estimate=0 ;
printf("Estimate=0 ;" "\n");
Estimate==value?printf("Great, you guessed it right!\n"):printf("Wrong, recalculate!\n");
printf("\n*************delimiter**************\n");
//a=0;b=0
value = !a;
printf("value = !a;" "\n");
Estimate=1 ;
printf("Estimate=1 ;" "\n");
Estimate==value?printf("Great, you guessed it right!\n"):printf("Wrong, recalculate!\n");
printf("\n*************delimiter**************\n");
//a=0;b=0
Estimate_a=0,Estimate_b=0,Estimate=Estimate;
printf("Estimate_a=0,Estimate_b=0,Estimate=Estimate;" "\n");
Estimate_a==a && Estimate_b==b && Estimate==value?printf("Great, you guessed it right!\n"):printf("Wrong, recalculate!\n");
printf("\n*************delimiter**************\n");
return 0;
}
linux@linux:~/test01$ gcc 1i8practicer.c
linux@linux:~/test01$ ./a.out
value = a && b;
Estimate=0 ;
Great, you guessed it right!
delimiter*
value = a || b;
Estimate=1 ;
Great, you guessed it right!
delimiter*
value = a || b;
Estimate=0 ;
Great, you guessed it right!
delimiter*
value = --a || b --;
Estimate=1 ;
Great, you guessed it right!
delimiter*
value = (a + b) || (a - b);
Estimate=0 ;
Great, you guessed it right!
delimiter*
value = (a * b) && (a + b);
Estimate=0 ;
Great, you guessed it right!
delimiter*
value = !a;
Estimate=1 ;
Great, you guessed it right!
delimiter*
Estimate_a=0,Estimate_b=0,Estimate=Estimate;
Great, you guessed it right!
delimiter*
linux@linux:~/test01$