int logic_call(){
printf("\n");
// Missed less then 10 days work AND
// Has over 30,000 OR
// Signed up more then 30 new customers
int bobMissedDays = 8, bobTotalSales = 24000,
bobNewCust = 32;
if(bobMissedDays < 10 && bobTotalSales > 30000 || bobNewCust > 30){
printf("Bob Gets a Raise\n\n");
}else{
printf("Bob Doesn't Get a Raise\n\n");
}
}
int ternary_operator(){
printf("\n");
int custAge = 38;
char* legalAge = (custAge > 21) ? "true" : "false";
printf("Is the customer of legal age? %s\n\n", legalAge);
int numOfProducts = 10;
printf("I bought %s products\n\n",
(numOfProducts > 1) ? "many" : "one");
}
void main(void){
// && - and
// !! - or
// ! - not !0 = 1, !1 = 0;
int custAge = 38;
if(custAge > 21 && custAge < 35)
printf("They are weclome\n\n");
else printf("They are not welcome\n\n");
printf("! turns a true into false : %d\n\n", !1);
logic_call();
ternary_operator();
}
댓글 없음:
댓글 쓰기