作者cplusplus (C++:ID暗藏玄機)
看板Programming
標題Re: [問題] 用C語言寫出200階乘...
時間Sat Jan 7 13:02:31 2006
: 那我也要提供一個 XD
: int i;
: cin >> i;
: if(i>>1<<1!=i)
: cout << "Odd" << endl;
: else
: cout << "even" << endl;
if(i&1)
cout<<"Odd"<<endl;
else
cout<<"Even"<<endl;
o_O...其實不用兩次位移
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.217.14
推 flashliqu:我知道 你的方法前面有人提過了 01/07 13:05
推 cplusplus:sorry 沒注意到 XD 01/07 13:14
推 sonyu:cout << (i&1?"Odd":"Even") << endl; 01/07 13:21