1.程序分析:
(a>b)?a:b
这是条件运算符的基本例子。
2.程序源代码:
其中 条件运算符 只能识别 1或者NULL。
2.程序源代码:
main()
{
int score;
char grade;
printf("pleaseinput a score\n");
scanf("%d",&score);
grade=score>=90?''A'': (score>=60? ''B'':''C'');
printf("%dbelongs to %c",score,grade);
}
其中 条件运算符 只能识别 1或者NULL。