http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: question??




>-----Original Message-----
>From:	Syk0000000000000@aol.com [SMTP:Syk0000000000000@aol.com]
>Sent:	Monday, November 27, 2000 10:13 PM
>To:	gameprogrammer@gameprogrammer.com
>Subject:	question??
>
>i am taking a class at my high school in c++ and i am using a header file
>called apmatrix.h that my teacher gave to me to write a program. i keep
>getting an illegal structure error whenever i put something simple like
>this
>
>#include<apmatrix.h>
>
>main()
>{
>       apmatrix<int> data(20,20,0);
>
>       if (data[3,3] == 0)
>             data[4,6] = 1;
>return 0;
>}
>it will give me an error in the if statement, well if anyone could possibly
>help me out please do, and thank you.
> << File: ATT00017.htm >>

Ick... people seem to be fudging this one. We can assume that the #include
and Constructor lines are compiling correctly, since the error is being
generated INSIDE the if statement.  The problem is more likely related to
the way you are using apmatrix, with the double brackets. Even assuming
your professor overloaded the brackets operator, I'm not sure that it can
take two arguments like that, as in data[4,6]. Usually this means evaluate
4, then evaluate 6 and return the 6. You might be able to do this with
multi-dimensional arrays, but I think you'd use data[4][6] instead, and I'm
pretty sure the operator[] only takes one argument anyways, so this seems
like very odd notation for a user-defined type. Summary, try

if (data[3][3] == 0)
	data[4][6] = 1;

and check his documentation to see how your prof is doing it.

SirFern


=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html




  • References:
    • RE: question??
      • From: "Jason G. Brunson" <Jason.Brunson@teamworldwide.net>