why code is not working properly

Discussion in 'C++' started by nik, Jul 27, 2006.

  1. nik

    nik Guest

    hello friends , iam working on finite state machine .i have some
    problem regarding code that i have executed in borland compiler
    ..following

    #include<iostream.h>
    #include<conio.h>
    #include<graphics.h>
    static int a,b,c;//d,e,f;
    class rectan
    {
    public:
    virtual void rectam()
    {
    }
    virtual void getdata()
    {
    }
    virtual void recta(int x1,int y1,int x2,int y2,int bc)
    {
    setcolor(bc);
    rectangle(x1,y1,x2,y2);
    }
    };
    class lin
    {
    public:
    void line_(int x1,int y1,int x2,int y2, int bc)
    {
    setcolor(bc);
    line(x1,y1,x2,y2);
    }
    };
    class smach:public rectan,public lin
    {
    public:
    void rectam()
    {
    outtextxy(235,0,"FINITE STATE MACHINE");
    rectan::recta(0,10,a,b,2);
    outtextxy(a/2-18,20,"STATE");
    outtextxy(a/2-27,32,"MACHINE");
    rectan::recta(a/2-30,15,a/2+30,45,5);
    }
    };
    class state:public rectan,public lin
    {
    protected:
    int s,j;
    public:
    void getdata()
    {
    cout<<"Enter the no of states max 5= "<<endl;
    cin>>s;
    c=s;
    }
    void rectam()

    {
    j=0 ;
    while(j<c)
    {
    rectan::recta(((a/c)((1/2)+j)-20),140,((a/c)((1/2)+j)+20),180,8);
    j++;
    }
    }
    };
    class event: public state
    {
    int u[10],i;
    public:
    void getdata()
    {
    cout<<"enter no of event in each state max 5 = "<<endl;
    i=0;
    while(i<c)
    {
    cin>>u;
    i++;
    }
    };
    void main()
    {
    int gd=DETECT,gm;
    rectan *ptr;
    rectan r;
    state t;
    ptr=&t;
    ptr->getdata();
    event e;
    ptr=&e;
    ptr->getdata();
    initgraph(&gd,&gm,"c:\\bc5\\bgi");
    a=getmaxx();
    b=getmaxy();
    ptr=&t;
    ptr->rectam();
    smach y;
    ptr=&y;
    ptr->rectam();
    getch();
    closegraph();
    restorecrtmode();
    }
    and flowing r the eror occur in it
    Info :Compiling C:\amit\fsmgra2.cpp
    Warn : fsmgra2.cpp(57,1):Functions containing while are not expanded
    inline
    Error: fsmgra2.cpp(59,3):Call of nonfunction
    Error: fsmgra2.cpp(59,3):Call of nonfunction
    Warn : fsmgra2.cpp(72,1):Functions containing while are not expanded
    inline
    Error: fsmgra2.cpp(101,1):Declaration terminated incorrectly
     
    nik, Jul 27, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. weasel
    Replies:
    8
    Views:
    360
    weasel
    Feb 22, 2004
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,131
    Smokey Grindel
    Dec 2, 2006
  3. nik
    Replies:
    1
    Views:
    288
    Ian Collins
    Jul 27, 2006
  4. nik
    Replies:
    4
    Views:
    386
    Victor Bazarov
    Jul 27, 2006
  5. Navneet Mathpal

    while loop is not working properly why

    Navneet Mathpal, Feb 18, 2014, in forum: Java
    Replies:
    2
    Views:
    125
    Roedy Green
    Feb 18, 2014
Loading...

Share This Page