I have a math quiz program that you can select a problem type or random, it will provide a summary. I need to add an array that will track all problems as well as answers. My question is should I use a multidimensional array or will a standard array work? Thanks
Thanks for the reply, this is for a beginning programming class and I am not looking to get my homework done.
The answer is probably more advanced than I need. The program gives math problems with randomly generated numbers. I need a display at the end that shows each problem with supplied answer and if correct or not. If the answer is wrong show the correct answer.
I have the program showing this information when the question is answered a summary with totals and percentage correct.
I need this information plus a repeat of the problem in a summary.
My question is would a multidimensional array do this in one array or should I set up an array for each situation (Addition right and wrong ect...).
The way I see it is this:
You have a problem.
You need to display the problems at the end.
A problem can modeled as a question, an answer, the correct answer and if it was answered correctly or not.
So that tells us that our requirements are:
- We need a model of a problem (a structure or a class).
- We need to store N problems. This implies an array (or more commonly, a vector).
Since the problem is one-dimensional, a multi-dimensional array does not make sense.
I would expand upon what jimblumberg gave you. It should be all you need to crack this.
That is the way I was thinking as well thanks for the confirmation..Still need to do some more reading on arrays...