### Can anyone take a quick look at my code to see why it's not following my teachers specifications correctly?

SOLVED
Last edited on
any help?
Without any real documentation or assignment instructions, it would take too long to try an figure out why you wrote things the way you did.
Anyways, by the way your instructor's response is worded, it sounds to me as if the alleged printing error is caused by one of the previous mistakes. I'd like to help further, but without assignment guidelines or some kind of documentation I'm not going to try and disect this. Maybe someone else on this forum will be more willing.
I can tell you, however, that assigning 0 to a variable of an unknown dataType is questionable, as it's not always guaranteed that it will be an integral type.
Last edited on
SOLVED
Last edited on
I would imagine that
 ``123456789101112131415161718`` ``````template bool Checkbook :: writeCheck (const DataType& amount) { if (amount > balance) return false; if (prevCheck [capacity - 1] != 0) doubleArray(); int i; for (i = 0; i < capacity; i++) { if (prevCheck[i] == 0) break; } size++; prevCheck[i] = amount; balance -= amount; return true; }``````

should look more like:

 ``1234567891011121314151617181920212223`` ``````template bool Checkbook :: writeCheck (const DataType& amount) { if (amount > balance) return false; if (prevCheck [capacity - 1] != 0) if ( size == capacity ) doubleArray(); int i; for (i = 0; i < capacity; i++) { if (prevCheck[i] == 0) break; } size++; prevCheck[i] = amount; prevCheck[size++] = amount ; balance -= amount ; return true; }``````

Where you should use size and capacity to determine whether the size and capacity of the array needs to be adjusted, not the values of the checks.

Wow awesome! That works perfectly. Now I'm going to study it to make sure I understand. Thanks!
Topic archived. No new replies allowed.