In Visual Studio, using C#, I've got three arrays that look something like this:
int[] price = new int[] { 100, 200, 300, 400, 500, 600 };
string[] goods = new string[] { "item1", "item2", "item3", "item4", "item5", "item6" };
bool[] cart = new bool[] { false, false, false, false, false, false };
The boolean cart represents checkboxes. Now what I want to do is, using a button, to check what boxes are ticked, and then sort of grab the name of the item from the array goods, and the price of it from the array price. Then I'll concatenate the strings, and add up the total sum, and just display that in a MessageBox.Show.
I'm thinking I need to tie the index of the cart array somehow to the corresponding indexes of the price and goods arrays. Or is there a better way of doing this? A for loop probably, but how? I'm not sure where to start. Help greatly appreciated!