代码
//
现代流行的"程序员"
private static bool IsOddFirst( int n)
{
while ( true )
{
switch (n)
{
case 1 :
return true ;
case 2 :
return false ;
}
n -= 2 ;
}
}
// 中归中矩的程序员
private static bool IsOddSecond( int n)
{
return (n % 2 == 1 ) ? true : false ;
}
// 有经验的程序员
private static bool IsOddThird( int n)
{
return Convert.ToBoolean(n % 2 );
// 或:return n % 2 == 1;
}
// 汇编程序员
private static bool IsOddFourthly( int n)
{
return Convert.ToBoolean(n & 1 );
}
private static bool IsOddFirst( int n)
{
while ( true )
{
switch (n)
{
case 1 :
return true ;
case 2 :
return false ;
}
n -= 2 ;
}
}
// 中归中矩的程序员
private static bool IsOddSecond( int n)
{
return (n % 2 == 1 ) ? true : false ;
}
// 有经验的程序员
private static bool IsOddThird( int n)
{
return Convert.ToBoolean(n % 2 );
// 或:return n % 2 == 1;
}
// 汇编程序员
private static bool IsOddFourthly( int n)
{
return Convert.ToBoolean(n & 1 );
}