Array question

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2005
Posts: 10
Reputation: shakoush2001 is an unknown quantity at this point 
Solved Threads: 0
shakoush2001 shakoush2001 is offline Offline
Newbie Poster

Array question

 
0
  #1
Jul 5th, 2005
Hi
Iam using Borland Builder 5, and Ive got 10 TImages called Image1, Image2....Image10. I want to add these images to an array of type TImage can I do that in a for loop or do i have to add each Image by itself.

//this is the method Iam using
TImage ImageArray[10];
ImageArray[0] = Image1;
ImageArray[1] = Image2;
ImageArray[9] = Image10;

//this is the method I want to use
for( int i = 0; i <10; i++)
{
ImageArray[i] = XXX //what should replace the XXX if this is possible
}
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: Array question

 
0
  #2
Jul 5th, 2005
You'll have to use the former method -- C++ programs don't know anything about their variable's names at run time.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC