标签:
BOOL BOOL a = YES; printf("%d\n", a); a = NO; printf("%d", a); int a = 0 , b = 0; BOOL result = YES; result = a > b; printf("%d\n", result); result = a == b; printf("%d\n",result); result = (a + b) <= ( a - b ); printf("%d\n", result); int a = 5 , b = 8, c = 2; BOOL result = a > b && a < c ; printf("result = %d\n",result); BOOL result1 = b != c && a >= c ; printf("result1 = %d",result1);
1 //逻辑或 2 BOOL result = a == b || b >= c; 3 printf("result = %d\n",result); 4 //逻辑非 5 BOOL result1 = !(a > c); 6 printf("result1 = %d", result1 ); 7 // 短路现象 8 int a = 5 , b = 8,c = 2 ; 9 BOOL result = a >= b && ++c; 10 printf("result = %d",c ); 11 int a = 5, b = 8,c = 2,d = 4; 12 BOOL r = (a >= b && b == c)||(a != b || b <= d ); 13 printf("r = %d",r );
char a = 0; scanf("%c",&a); if (a == ‘m‘ || a == ‘M‘) { printf("男"); } else printf("女"); char a = 0 ; scanf("%c",&a); if (a == 77 || a == 109) { printf("男"); } else printf("nv"); printf("hello"); int n = 0; scanf("%d",&n); if (n >=0 && n <=18) { printf("%d在范围之内", n ); } else printf("%d不在范围之内\n", n ); printf("hello");
//能被400 整除 或者能被4 但不能被100 整除 int a = 0; scanf("%d",&a); if (a % 400 == 0 || (a % 4 == 0 && a % 100 != 0)) { printf("run"); } else printf("NO");
1 int telnumber = 0; 2 scanf("%d",&telnumber); 3 printf("分机号为%d\n",telnumber); 4 switch (telnumber) { 5 case 1: 6 printf("1"); 7 break; 8 case 2: 9 printf("2"); 10 break; 11 case 3: 12 printf("3"); 13 break; 14 case 4: 15 printf("4"); 16 break; 17 case 5: 18 printf("5"); 19 break; 20 case 6: 21 printf("6"); 22 break; 23 default: 24 printf("没有"); 25 break; 26 } 27 printf("\nduang!!!!!分析完毕");
int a = 0, b = 0; scanf("%d%d",&a , &b ); int max = 0; max = (a > b )? a * a : b * b; printf("最大值为%d",max);
标签:
原文地址:http://www.cnblogs.com/IT-jqm/p/C_testDay01.html