Mail Archives: djgpp/2001/03/03/20:36:41
NNTP-Posting-Host: | 200.245.19.241
|
Newsgroups: | comp.os.msdos.djgpp
|
Date: | Sat, 3 Mar 2001 20:09:05 -0500
|
Message-ID: | <3AA195B1.ED50BFD7@__mad.scientist.com-->
|
From: | Anderson <--anderson DOT comp__ AT __mad DOT scientist DOT com-->
|
Subject: | BUG: Code or Compiler?
|
Organization: | Pennsylvania College of Technology
|
Lines: | 41
|
Mime-Version: | 1.0
|
X-Mailer: | Mozilla 4.7 [en] (Win95; I)
|
X-Accept-Language: | en
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi everybody!
I was playing with arrays (for matrix calculation) when I've got this
strange error. When I set the value it seems ok, but when I check it
out... it's not there anymore!
Here's the bugged code:
----------------------------------------
int X=2;
int Y=2;
for (int i=0; i<X ; i++){
for (int j=0; j<Y ; j++){
if (i==j) data[i,j]=1; // defines a 2x2 identity matrix
else data[i,j]=0;
cout << data [i,j] <<", "; // SEEMS OK...
}
}
cout << endl;
// check it out
for (int i=0; i<X ; i++){
for (int j=0; j<Y ; j++){
cout << data [i,j] <<", "; // WRONG!!! WHY ???
}
}
-----------------------------------------
Any clue?
I'm using djgpp + rhide.
Thanks a lot!
Anderson.
(to send me email, please remove underscores/dashes from my address. You
know, spammers are very boring... :-)
--
=========================================
"Any sufficiently advanced technology is
indistinguishable from magic. "
Arthur C. Clarke
- Raw text -