易截截图软件、单文件、免安装、纯绿色、仅160KB

用C编写state machine

有4个state 的state machine
  x=0, y=0 state0
  x=1, y=0 state1
  x=0, y=1 state2
  x=1, y=1 state3
想请教各位大侠 是不是可以这样编写state machine?
大家工作中一般都用什么方法编写state machine呢?
int main()
{
。。。
while (1)
{
while (x=0, y=0)
{
state0;
}
while (x=0, y=1)
{
state1;
}
while (x=1, y=0)
{
state2;
}
while (x=1, y=1)
{
state3;
}
}
。。。
}

写得太粗了,呵呵。


相关问答:

jsp中 <c:if test> 相关问题

在查询后将查询出来的值赋给各输入框
<c:if test="${not empty dataValue}">
      fm.SAMPLING_DATE.value=" <c:out value='${dataValue.SAMPLING_DATE}'/ ......

菜鸟求解:c图形问题

#include <stdio.h>
#include <graphics.h>
void main()
{
  int x0,y0,x1,y1,driver,mode,i;
  driver=VGA;
  mode=VGAHI;
  initgraph(&driver,&mode,&qu ......

你们现在还在用C吗?C有前途吗?

你们现在还在用C吗?C有前途吗?
一定,并永远坚持

引用
一定,并永远坚持



有用。

楼主何出此言

楼主来c版问这个问题是踢馆用意吗哈哈

越来越冷是肯定的,完全淘汰倒也没那么容易

c ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号