用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;
}
}
。。。
}
写得太粗了,呵呵。
相关问答:
以前在VC里面建一个工程,都只用一个 .c 文件,昨天在一个工程里用了两个 .c文件了,遇到问题了,请大家指点。比如:
File1.c Fil ......
#include <stdio.h>
#include <graphics.h>
void main()
{
int x0,y0,x1,y1,driver,mode,i;
driver=VGA;
mode=VGAHI;
initgraph(&driver,&mode,&qu ......
问一下:
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......
最近突然想自己来实现一个五子棋程序,但不知道怎么开始,自己也没学画图形函数,能在控制台下直接写吗>>>?????
控制台?比图形界面更麻烦。
http://search.download.csdn.net/search/%E4%BA%94%E5%AD%90% ......
你们现在还在用C吗?C有前途吗?
一定,并永远坚持
引用
一定,并永远坚持
顶
有用。
楼主何出此言
楼主来c版问这个问题是踢馆用意吗哈哈
越来越冷是肯定的,完全淘汰倒也没那么容易
c ......