Hey ya'll, I have huge problem with my code; im trying to pass a number to a class function and have it add it to an array of that class. The problem I get is that when I display the array, it just gives me the memory address and not the data of the array. I was expecting it to display 12 0 0 0 0 0 ect.
any help would be a life-saver ;p
I'm afraid you have quite a few bugs in your code.
First, you array member is never initialized to something. You should create a constructor that set the whole array to 0 for example. If you don't know how to do it, let me know.
Second, in total(), you have a loop with i from 0 o 12 (not included), but you don't use i, you print out 12 times array[0]. I suppose this is not what you want.
Third, in your storeValue, what will hapen when your array will be full of numbers different that 0 ? You'll try to access something undefined and your program will crash.
Thanks for the quick response aleonard. Here is my code so far. I added a constructor, but i'm unsure as to how to go about setting the whole array equal to zero(if it doesn't automatically do that). I fixed the total() function. The big problem I cant wrap my head around is the storeValue function. I'm trying to get it to accept a value, store it in the next available element of the array. and return false when all elements have been used up. The code keeps returning false; my guess is that the array isn't initialized to zero. I thought as long as a space was available in the array it was automatically set to zero; thanks for any input you may have ;p