473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

why code is not working properly

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 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];
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

Jul 27 '06 #1
4 1770
In article <11**********************@m73g2000cwd.googlegroups .com>,
"nik" <am*******@gmail.comwrote:
hello friends , iam working on finite state machine .i have some
problem regarding code that i have executed in borland compiler
.following
rectan::recta(((a/c)((1/2)+j)-20),140,((a/c)((1/2)+j)+20),180,8);
and flowing r the eror occur in it
Info :Compiling C:\amit\fsmgra2.cpp
Error: fsmgra2.cpp(59,3):Call of nonfunction
Error: fsmgra2.cpp(59,3):Call of nonfunction
My compiler says:
error: '(a / c)' cannot be used as a function

The compiler thinks you are trying to call the function (a/c) with the
argument ((1/2)+j).

See if you can't remove some of those parens.
Jul 27 '06 #2

Daniel T. wrote:
In article <11**********************@m73g2000cwd.googlegroups .com>,
"nik" <am*******@gmail.comwrote:
hello friends , iam working on finite state machine .i have some
problem regarding code that i have executed in borland compiler
.following
rectan::recta(((a/c)((1/2)+j)-20),140,((a/c)((1/2)+j)+20),180,8);
and flowing r the eror occur in it
Info :Compiling C:\amit\fsmgra2.cpp
Error: fsmgra2.cpp(59,3):Call of nonfunction
Error: fsmgra2.cpp(59,3):Call of nonfunction

My compiler says:
error: '(a / c)' cannot be used as a function

The compiler thinks you are trying to call the function (a/c) with the
argument ((1/2)+j).

See if you can't remove some of those parens.
Not so much the parens -- perhaps you meant ((a/c)*((1/2)+j)-20)

??

Jul 27 '06 #3
"Daniel T." <da******@earthlink.netwrote...
In article <11**********************@m73g2000cwd.googlegroups .com>,
"nik" <am*******@gmail.comwrote:
>hello friends , iam working on finite state machine .i have some
problem regarding code that i have executed in borland compiler
.following
>rectan::recta(((a/c)((1/2)+j)-20),140,((a/c)((1/2)+j)+20),180,8);
>and flowing r the eror occur in it
Info :Compiling C:\amit\fsmgra2.cpp
Error: fsmgra2.cpp(59,3):Call of nonfunction
Error: fsmgra2.cpp(59,3):Call of nonfunction

My compiler says:
error: '(a / c)' cannot be used as a function

The compiler thinks you are trying to call the function (a/c) with the
argument ((1/2)+j).

See if you can't remove some of those parens.
Could it be multiplication operators are missing there somewhere?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 27 '06 #4
<sh**********@comcast.netwrote...
>
Daniel T. wrote:
>In article <11**********************@m73g2000cwd.googlegroups .com>,
"nik" <am*******@gmail.comwrote:
hello friends , iam working on finite state machine .i have some
problem regarding code that i have executed in borland compiler
.following
rectan::recta(((a/c)((1/2)+j)-20),140,((a/c)((1/2)+j)+20),180,8);
and flowing r the eror occur in it
Info :Compiling C:\amit\fsmgra2.cpp
Error: fsmgra2.cpp(59,3):Call of nonfunction
Error: fsmgra2.cpp(59,3):Call of nonfunction

My compiler says:
error: '(a / c)' cannot be used as a function

The compiler thinks you are trying to call the function (a/c) with the
argument ((1/2)+j).

See if you can't remove some of those parens.

Not so much the parens -- perhaps you meant ((a/c)*((1/2)+j)-20)

??
I'd bet that too. Only 1/2 is just 0. Probably 0.5 was intended...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: weasel | last post by:
Why is the Farenheit to Celsius part not working properly? Instead of showing a similar range of what the farenheit is listing, the celsius portion is showing half the range of farenheit. print...
6
by: Brian Miller | last post by:
I've been constructing an ASP.Net application using the 1.1 framework, and have been using Web Matrix for development purposes. Now that my application is near completion, I wanted to see if I can...
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
17
by: tshad | last post by:
Many (if not most) have said that code-behind is best if working in teams - which does seem logical. How do you deal with the flow of the work? I have someone who is good at designing, but...
4
by: qbproger | last post by:
I'm developing a plugin for some software. The previous version of the software didn't require a start in directory to be set. This allowed me to leave the working directory to the default in the...
4
by: candexis | last post by:
Hi!!!!!!! could you please tell me why this code in not working properly, the thing is that when I read one string after another, the second one is not read, and I don't know why, I am using...
9
by: javakid | last post by:
Hi Following form validatioin code is working fine on IE but not working on Mozilla Firefox V2. Can any body suggest? Regards <script ="JAVASCRIPT" type="text/javascript">...
3
by: rajasree | last post by:
Hi all, am doing a project in PHP. my javascript code is working properly in ie. But its not working in firefox. Please help me my code is as follows; <script language="javascript"...
7
by: robin1983 | last post by:
Hi, good morning everyone, i have a file called attendence.php The problem is that some part of code is executing properly and half of the code is not and i dont get any warning or error message. For...
8
by: Brett | last post by:
I wrote an ASP.NET application that queries a SQL Server database (on a different box from the web server) and displays the result in a GridView. The datasource for the GridView is a SQLDataSource....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.