![](/img/trans.png)
[英]How can I turn off interrupt that switching threads in OS, on short time, for my critical part of code?
[英]How can i short my if else code which cointais value of variable?
我正在尝试缩短代码,但现在这不起作用。 我需要缩短代码的运行时间。有没有人可以告诉我这段代码的错误和这段代码的解决方案。
# include <stdio.h>
int main( )
{
int bonus, cy, yoj, yos ;
printf ( "Enter current year and year of joining " ) ;
scanf ( "%d %d", &cy, &yoj ) ;
yos = cy - yoj ;
( yos > 3 )? bonus=100:printf ( "Bonus = Rs. %d\n", bonus );
return 0 ;
}
它不是这样工作的。
由于您没有提到如果yos < 3
会发生什么,我决定将 bonus 设置为0
。
printf ( "Bonus = Rs. %d\n", bonus = ( yos > 3 ) ? 2500 : 0 );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.