I'm experiencing a problem within my program. I am to make a program that will let the user input 30 days of allowance and all of their accumulated expenses for that month then the program will subtract the allowance from the expenses. I am to use two dimensional arrays, pointers, structures and user-defined functions.
Long story short, I haven't gotten around the expenses part yet but I'm already experiencing a problem. Whenever I try my code, the sum of the allowance I input exceeds the actual answer. For example, I will input "1" for every day. Then the sum should be 30, correct? But the sum seems to exceed that. It seems to be a logical error on my part but I don't see it.
This code only executes once, but the inner loop goes 30 times (not 7 for a week?). The variable is called week, but there are 2 (not 4 - 1 for each week?) similar for loops. Wait, I'm confused !!!!
for(int week=0;week<1;week++)
So potentially you could have 60 days worth of expenses for 1 month!! This is also reflected in you int allowance[1][30] Arrays start at 0 - so this has 2 * 30 elements.