Code for RE to NFA

Discussion in 'Programming' started by hocpana, Aug 3, 2011.

  1. #1
    Please look at this code, i can not make it fulfill for RE to NFA conversion. If anyone know try to solve.
    #include <stdio.h>
    #include <conio.h>
    #include <graphics.h>
    #include <stdlib.h>
    void main()
    {
    clrscr();
    int gdriver = DETECT, gmode,i=0;
    char a,data[5];

    printf("expression:");
    do
    { a=getchar();
    data=a;
    i++;
    }while(a!='\n');
    initgraph(&gdriver, &gmode, "c:\tc\bgi");
    if(data[1]=='+')
    {
    circle(40,100,8);
    circle(100,100,8);
    circle(300,100,8);
    circle(150,50,8);
    circle(250,50,8);
    circle(150,150,8);
    circle(250,150,8);
    circle(370,100,8);
    circle(370,100,12);
    line(40,100,100,100);
    line(100,100,150,50);
    line(150,50,250,50);
    line(100,100,150,150);
    line(150,150,250,150);
    line(250,50,300,100);
    line(300,100,250,150);
    line(300,100,370,100);
    outtextxy(120,60,"e");
    outtextxy(120,130,"e");
    outtextxy(280,60,"e");
    outtextxy(280,130,"e");
    outtextxy(200,40,"a");
    outtextxy(200,160,"b");
    outtextxy(70,90,"e");
    outtextxy(340,90,"e");
    }
    else
    {
    circle(100,100,10);
    circle(200,100,10);
    circle(300,100,10);
    line(110,100,200,100);
    line(200,100,300,100);
    outtextxy(150,80,"a");
    outtextxy(250,80,"b");
    }
    getch();
    closegraph();

    }

     
    hocpana, Aug 3, 2011 IP