+=运算符和三目运算符
#include <stdio.h> #include <stdlib.h> int main(){ int a,b,c,big; //三目运算符: ? : //三个数取最大值 while(scanf("%d%d%d",&a,&b,&c)!= EOF) { big = (a>b?a:b)>c?(a>b?a:b):c; printf("big=%d\n",big); } //a += b 等于 a+=b a += b; printf("a=%d\n",a); printf("c=%d\n",c); system("pause"); }
1234567891011121314151617