Benjamin_Barrett
asked on
Multi-dimensional arrays
Ok, Im close to finishing my project and the last problem is to enable Logging.
The project is menu based and the user selects from 5 options and does different stuff. Fine.
However, the logging requirements are to Display the option, the Count of times it has been accessed & the Order its been accessed.
And the Order only stores the last 10 option calls
The example is
OPTION COUNT ORDER
1 1 1
2 0
3 3 3,4
4 10 2,5,6,7,8,10
5 0
6 1 9
So you can from that example, that the user has been using option 4 alot - 10 times & the order has recorded only the last 6 - as it stores only the last 10 option calls.
Hope that explains the problem.
My solution was to have a double array
int sessionLog[6][2] = {{0,0},{0,0},{0,0},{0,0},{ 0,0},{0,0} };
So the first element would hold the total Count that option has been used and the second is the Order it was accessed. Both could be incremented as needed.
Then *crunch*
I realized that thats fine if each option is only accessed *once*.
So that's my question I need some help with - how could it store multiple accesses? A triple array??
Or what about an array of arrays?
Any ideas?
The project is menu based and the user selects from 5 options and does different stuff. Fine.
However, the logging requirements are to Display the option, the Count of times it has been accessed & the Order its been accessed.
And the Order only stores the last 10 option calls
The example is
OPTION COUNT ORDER
1 1 1
2 0
3 3 3,4
4 10 2,5,6,7,8,10
5 0
6 1 9
So you can from that example, that the user has been using option 4 alot - 10 times & the order has recorded only the last 6 - as it stores only the last 10 option calls.
Hope that explains the problem.
My solution was to have a double array
int sessionLog[6][2] = {{0,0},{0,0},{0,0},{0,0},{
So the first element would hold the total Count that option has been used and the second is the Order it was accessed. Both could be incremented as needed.
Then *crunch*
I realized that thats fine if each option is only accessed *once*.
So that's my question I need some help with - how could it store multiple accesses? A triple array??
Or what about an array of arrays?
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent, many thanks SunnyCoder.
ASKER