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];

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.


Recommended Answers

All 2 Replies

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.

thanks bro just the help I need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.