944,038 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2075
  • C++ RSS
May 19th, 2006
0

Displaying values of an array

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rontab68 is offline Offline
13 posts
since Mar 2006
May 19th, 2006
0

Re: Displaying values of an array

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.
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
May 19th, 2006
0

Re: Displaying values of an array

thanks bro just the help I need.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
rontab68 is offline Offline
13 posts
since Mar 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: converting from float 2 integer
Next Thread in C++ Forum Timeline: container classes and integrators-urgent





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC