All replies

In C++ (and C) there is no built-in way in the language to get the size of an array; you either need to use the size that the array was declared with or use one of the many language "tricks" that will give you the size of an array.

Given an array declaration like:

const int SIZE = 10;

int myArray[SIZE];

I would iterate through the elements of the array using one of the following snippets:

In my app I am aiming to put the trackbar position value into an array each time the user clicks on button to move to the next question where he/she will be asked to position the trackbar again as a response to the question.

When it comes to writing managed code with C++ the code is remarkably similar to the equivalent C# code. One of the biggest differences is that C++ keeps the syntactic difference in referring to an object on the stack and an onject on the heap.

So the code above would be translated to:

TextWriter^ tw = gcnew StreamWriter("D:\\path\\file.txt");

tw->Write("barney");tw->Close();

As you can see the code is remarkably similar: the major difference is the use of ^ and -> and these are used because the StreamWriter object is created on the GC heap (via gcnew).

I'm going round in circles with this one! When I look at the Events properties for the Track Bar I see that the name to the right of the Scroll behaviour property is trackBar1_Scroll so if I just wish to print out this value, forgetting putting it into an array for the moment, what would I use?

Is there an equivalent to the C# MessageBox.Show? Or how do I print to the Console?