Displaying values of an array

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

Join Date: Mar 2006
Posts: 13
Reputation: rontab68 is an unknown quantity at this point 
Solved Threads: 0
rontab68 rontab68 is offline Offline
Newbie Poster

Displaying values of an array

 
0
  #1
May 19th, 2006
Hi, lets say I have an array of numbers
then I want to display a certain array element.
the value inside it,that is.

in pseudo code that would be..

int array[5][5];

for(x=0;x<6;x++)
{
if x= array[0][1];
}
;
;
;
message output " the value is array[0][1]"



I want to implement this in Visual C++.

using MessageBox command wont work unless i enclosed them in "" "" but that would not output the element in the array...Pls help.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: Displaying values of an array

 
0
  #2
May 19th, 2006
Use a function like sprintf or snprintf to create the string you want to display, and then input that string to the MessageBox function. The sprintf function gives you the ability to embed an integer inside a string, by using the %d format specifier. It is similar to printf, the difference is printf outputs the string to standard output, while sprintf outputs it to a character buffer.
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 13
Reputation: rontab68 is an unknown quantity at this point 
Solved Threads: 0
rontab68 rontab68 is offline Offline
Newbie Poster

Re: Displaying values of an array

 
0
  #3
May 19th, 2006
thanks bro just the help I need.
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