G***G 发帖数: 16778 | 1 四个开关
Can1,Can2, Can3,Can4
1)条件是Can1,Can2,Can3, Can4都是1的时候,执行A
2)条件是这四个有且只有3个是1的时候,
执行B1(对应Can1, can2,can3)
执行B2 (对应Can1,Can2, Can4)
.....
执行B4 (对应Can2, can3,can4)
3)条件是四个中有且只有2个是1的时候
执行C1 (can1, can2)
执行C2 (can1, can3)
...
执行C6 (can3, can4)
4)只有一个是1的时候
执行D1 (can1)
...
执行D4 (can4)
我的问题是,用if else 嵌套好,还是用switch case好?switch case怎么写这个算法?
谢谢! |
|
j**4 发帖数: 10425 | 2 haha. nao3 can2 de ren2, zui4 ai4 shuo1 bie2 ren2 nao3 can2 |
|
|
|
d********y 发帖数: 2114 | 5 蚕can2
几年前养过几只。专门买了颗桑椹。
50只太多了。 |
|
|
|
j**4 发帖数: 10425 | 8 nao3 can2? i think these are pretty decent, ni3 bu4 yi1 ding4 you3 zhe4 me
gao1 de zhi4 shang1 |
|
b**********2 发帖数: 1923 | 9 how nao3 can2 do u have to be to be LOLing at everything? are u like a 15
year old high school girl chatting online??
oops, i forgot u are a member of the 15 year old high school girl clique... |
|
T********e 发帖数: 8631 | 10 还真有sunset hike呢。But扭腰的这帮lao3 rou4 bing4 can2,已经suggest要watch爬
山的片子instead啦。 |
|
j**4 发帖数: 10425 | 11 have absolutely no idea. i only have one wife from mitbbs, working2009. u
called her nao3 can2? |
|
j**4 发帖数: 10425 | 12 actually, i think everything is nao3 can2...
take the stupid fucking opera for example. it's considered "high class", but
the opera played at MET last night, when it boils down to it, is just like
wife swap, or real housewives... it's just dressed in a "high class"
costume... |
|
|
n******e 发帖数: 708 | 14 Still very handsome.. didn't can2 |
|
s**d 发帖数: 787 | 15 lao you ji? is that what they call "Friends" in chinese? at first it thought
it was a chinese classic or something. i know there is a book called lao3
can2 you2 ji4. |
|
|
|
|
N******t 发帖数: 16051 | 19
我不是 >< 我 c ch 分得很清的!!就是我从小一直念chan2的啊,从木有听过can2 @@
肿么会这样。。。 |
|
|
m***t 发帖数: 4509 | 21 zi4 can2
偶的意思坎的是胳膊腿儿什么的。 |
|
s********g 发帖数: 92 | 22 unsigned char sw=can4<<3 | can3<<2 | can2<<1 | can1;
switch(sw){
case 1:
//operation D1
break;
case 2:
//operation D2
break;
...
case 13:
//operation B2
break;
case 14:
//operation B1
break;
case 15:
//operation A
} |
|
b*****e 发帖数: 1193 | 23 can2.0B仅仅是定义datalink layer,很简单
更复杂的应用和功能都在高层协议定义,如1939,15765,canopen等等。
“I was waiting for your reply, actually. I knew you are good at this”
莫非你知道我是谁? |
|