資源簡介
求上下文無關文法中求出導空符,運用c語言程序來編寫其源代碼。
代碼片段和文件信息
?#include
typedef?struct?onep
????????????{
??????????????char?l;
??????????????char?r[100];
??????????????int?length;
????????????}one;
void?main()
{
??one?production[100];
??one?temp;
??int?e[100];
??int?change;
??char?ch;
??int?vikjrem;
??v=i=j=k=0;
??change=1;
??temp.length=0;
??printf(“please?input?char:\n“);
??ch=getchar();
??/*將符號串輸入到數組production中*/
??while(ch!=‘#‘)
???????{
????????????if(ch>=‘a‘&&ch<=‘z‘||ch>=‘A‘&&ch<=‘Z‘&&temp.length==0)
????????????{
????????????????temp.l=ch;
????????????}
????????????ch=getchar();
????????????if(ch==‘>‘)
????????????{
????????????????ch=getchar();
????????????????while(ch!=‘‘&&ch!=‘#‘)
????????????????{?
????????????????????temp.r[temp.length]=ch;
????????????????????temp.length++;
????????????
- 上一篇:基于Socket的簡單的2人對打游戲源代碼(VC)
- 下一篇:c語言實現圖的拓撲排序
評論
共有 條評論