N
nik
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 smachublic 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 stateublic 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)eclaration terminated incorrectly
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 smachublic 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 stateublic 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)eclaration terminated incorrectly