Monday 15 April 2013

How to store two integers in one array (C++) -


I would like to create an array which can store the ID and contents in a single cell. I want to store the information so that I can get both pieces of information from one part of the input.

Currently I am doing it like this:

  int order [100]; Int content [100]; Int count = 0; // To add a new piece of method, zero setframe (Int nextOrder, int nextcontent) {order [count] = nextOrder; Content [count] = next communication; Count ++; }  

This works, but I would like a way to call an array like array [i], and I will get two integers from it. How can I do this?

Create a struct :

  Structure data {IT order; Int content; }; Data array [100]; Int count = 0; // To add a new piece of method, zero setframe (Int nextOrder, int nextcontent) {array [array] .order = nextOrder; Array [count] Material = next resource; Count ++; }  

No comments:

Post a Comment