Also, can you post the actual question for the assignment?
I think you would benefit from doing a basic design. I do it all the time.
You start with a blank cpp file that has main() in it.
Write a bunch of comments that describe how your going to do your program. Describe things like, individual actions that you need to do, with a view to what functions you are going to have. Here is an example for a basic calculator that i have been helping with:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
//include files
//function declarations
int main() {
//variable declarations
//while (not quit){
//Getnumber
//GetOperator
//Getnumber
//CalcAnswer
} //end of while loop
} //end of main
//function definitions
//Getnumber function
//GetOperator function
//CalcAnswer function
|
So you can see here the thought process is logically setout.
What you do next is to go through and decide what the functions need as arguments and what they are going to return. Also what variables do you need of what type? In your case, what arrays do you need, of what size? Some of the variables might be local to the functions, instead of putting them all in main.
Remember what I said about variable names, this is a key thing for understanding
So then you get to start putting in code, leave the comments in, because they serve as documentation.
Now you can see how there is a logical & organised process to develop your code.
It sounds boring, but it can save you writing 200 lines of code, that becomes an unintelligible mess, when you might have had 50 lines of code that is really easy for anyone to understand.
Again I am doing this so you can become a better programmer.
Cheers