 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
nik Guest
|
Posted: Thu Jul 27, 2006 9:10 am Post subject: why code is not working properly |
|
|
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, ;
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];
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 |
|
| Back to top |
|
 |
Ian Collins Guest
|
Posted: Thu Jul 27, 2006 9:11 am Post subject: Re: why code is not working properly |
|
|
nik wrote:
Don't post three times!
| Quote: | 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
|
You should be using <iostream>
| Quote: | #include<conio.h
#include<graphics.h
|
Neither of these are standard, this makes it difficult for people to
compile your code.
[whitespace free code snipped]
Missing semicolon.
| Quote: | 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
|
rectan::recta isn't a static member function.
| Quote: | Warn : fsmgra2.cpp(72,1):Functions containing while are not expanded
inline
Error: fsmgra2.cpp(101,1):Declaration terminated incorrectly
|
--
Ian Collins. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|