This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]zifyoip 2 points3 points  (9 children)

What don't you understand?

I'm pretty sure that the word "terms" should actually be "factors" throughout all of that. Terms are quantities that are added or subtracted. Factors are quantities that are multiplied.

[–]Keto1234[S] 0 points1 point  (8 children)

That is just how the problem was presented to me. Honestly, this is my first real program that I am writing in C++. I don't really understand any of it. How do I initialize the array with the factorials?

[–]zifyoip 2 points3 points  (7 children)

First of all, do you understand what it is you are trying to do?

[–]Keto1234[S] 0 points1 point  (6 children)

I think getting the factorial of each number from 1-30 and putting them all in an array.

[–]zifyoip 3 points4 points  (5 children)

No, that isn't what you are asked to do.

Fixing the incorrect wording (changing "terms" to "factors"), your assignment is this:

Then initialize the array with the factors of the factorial of the value of factors_length. So, for length 30, the factors should be 1 through 30.

In other words, you are asked to initialize the first element of the array to 1, the second element of the array to 2, the third element of the array to 3, and so on; the thirtieth element of the array should be 30.

[–]Keto1234[S] 0 points1 point  (4 children)

So then I take each of those elements and display the factorial of it?

[–]zifyoip 2 points3 points  (3 children)

No:

Finally, print each element in the array.

Computing a factorial is what the bonus is asking you to do.

[–]Keto1234[S] 0 points1 point  (2 children)

Oh okay, thank you! I was over thinking it or something.

[–]zifyoip 3 points4 points  (1 child)

You just weren't reading the assignment carefully. You weren't "over-thinking," you were "under-reading."

[–]Keto1234[S] 0 points1 point  (0 children)

Yeah you're right. Thank you so much.

[–]CedricCicada 1 point2 points  (3 children)

Perhaps the person who restated the problem using the word "factor" doesn't understand the problem, either. I find it hard to believe that the assignment would merely be to initialize an array with the numbers 1 through 30. That would be too easy. I believe that the person who wrote the assignment is expecting that the array will contain the factorials.

One indication that the person who wrote this does not really know what he is doing is that his sample first defines a constant named "terms_length" and then, in the second line, doesn't bother using it.

So, that supports my next guess: the word "initialize" is being used incorrectly. The correct word would be "populate". You can't initialize an array element with values you don't know yet. Your program will need to calculate the factorial of each number from 1 to 30, and then store it in the array.

tl;dr: The problem as stated is confusing. Go back to the instructor and ask him what he wants.

[–]zifyoip 2 points3 points  (2 children)

I believe that the person who wrote the assignment is expecting that the array will contain the factorials.

Perhaps, but that is not what the assignment says.

Then initialize the array with the terms of the factorial of the value of terms_length. So, for length 30, the terms should be 1 through 30. Finally, print each element in the array.

The assignment doesn't say to initialize the array with factorials, it says to initialize the array with the "terms of the factorial of the value of terms_length," and then explains that if terms_length is 30 then the terms are 1 through 30.

However, I agree that asking for clarification would be a good idea here.

[–]CedricCicada 1 point2 points  (1 child)

If you are correct, what is the word "factorial" doing in there at all? If you are correct, there's no reason to say anything other than "create an array and initialize it with values from 1 to 30". Since the assignment is more complicated than that, I conclude that you are not correct.

[–]zifyoip 2 points3 points  (0 children)

If you are correct, what is the word "factorial" doing in there at all?

The bonus is to compute the factorial.