运行两次,倒数第三个位置没变,结果却变了?
#include <stdio.h>
int main()
{
double money =12 ;
double cost =11.5 ;
printf("小编能不能打车回家呢:");
printf("%c\n",money>=cost?'y':'n');
printf("%c\n",(money>=cost)?'y':'n');
printf("%c\n",(money>cost)||(money=cost)?'y':'n');
printf("%c\n",(money=cost)||(money>cost)?'y':'n');
printf("%c\n",((money>cost)||(money=cost))?'y':'n');
printf("%c\n",(money>cost)&&(money=cost)?'y':'n');
printf("%c\n",(money=cost)&&(money>cost)?'y':'n');
printf("%c\n",((money>cost)&&(money=cost))?'y':'n');
return 0;
}
#include <stdio.h>
int main()
{
double money =12 ;
double cost =11.5 ;
printf("小编能不能打车回家呢:");
printf("%c\n",money>=cost?'y':'n');
printf("%c\n",(money>=cost)?'y':'n');
printf("%c\n",(money>cost)||(money=cost)?'y':'n');
printf("%c\n",((money>cost)||(money=cost))?'y':'n');
printf("%c\n",(money>cost)&&(money=cost)?'y':'n');
printf("%c\n",(money=cost)&&(money>cost)?'y':'n');
printf("%c\n",((money>cost)&&(money=cost))?'y':'n');
return 0;
}