954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help Error C2064

Hi Everyone,
I am trying to compile a code and I keep getting error C2064: term does not evaluate to a function taking 1 arguments

here is my code(actually I got it from a book),can anyone help me what is wrong?

thanks
Negin

#include
#include
using namespace std;

class tridiagonal
{
private:
int i,n;
double *x,*a,*b,*c,*beta,*gamma,*r;

public:
void input ();

void solution ();

~tridiagonal ()
{
delete [] x,a,b,c,beta,gamma,r;
}

};
void main()
{
tridiagonal matrix;
matrix.input ();
matrix.solution ();

}
void tridiagonal :: input()
{
cout<<"Enter number of equations:\n";
cin >>n;

a=new double[n-1];
b=new double[n];
c=new double [n-1];
beta=new double[n];
gamma=new double [n];
r=new double [n];
x=new double [n];
for (i=0; i> b[i];}

for (i=0; i<(n-1); i++)
{ cout<<"Enter c["<> c[i];}

for (i=1; i> a[i-1];}

for (i=0; i>r[i];}
}

void tridiagonal :: solution()
{
for (i=0; i=0 ; i--)
{ x[i]=gamma[i]-c[i]*x[i+1]/beta[i]; }
for (i=0; i

negneg
Newbie Poster
6 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Use code tags. Without them, all your indentation goes away, which makes your code very hard to read.

If your book really contained the line

delete [] x,a,b,c,beta,gamma,r;

then I suggest you stop using that book, because the author doesn't know C++ very well. Ditto for the overall design of the program.

That said, the first place I'd look for your error is in the line

x(n-1)=gamma(n-1);

which surely should be

x[n-1]=gamma[n-1];

if that's not the only problem, please repost the code using code tags, and please tell us which line or lines the compiler said was in error.

arkoenig
Master Poster
703 posts since Jun 2010
Reputation Points: 359
Solved Threads: 109
 

Thanks ,That seemed to be the problem.

Since I just started learning C++ by myself can you tellme how to force the program run line by line to find the problem?

negneg
Newbie Poster
6 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Every time the compiler prints an error message during compilation, that message includes the number of the line with the problem.

arkoenig
Master Poster
703 posts since Jun 2010
Reputation Points: 359
Solved Threads: 109
 

>>Every time the compiler prints an error message during compilation, that message includes the number of the line with the problem.
And, in many IDEs, you can double-click the error message to be taken to the location of the error.

Fbody
Posting Maven
2,930 posts since Oct 2009
Reputation Points: 833
Solved Threads: 393
 

Thanks everyone

negneg
Newbie Poster
6 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: