Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (anonymous):

was wondering if someone could help me with how to put this program together. I dont really understand what they want me to do! http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/unit-1/lecture-6-recursion/MIT6_00SCS11_ps2.pdf

OpenStudy (anonymous):

bump

OpenStudy (anonymous):

which problem exactly?

OpenStudy (mandre):

I use C++ and not Python so bear that in mind. The hangman program should be relatively simple. Place each letter of the word in an array then use a FOR loop to cycle through each letter and test it against the letter entered by the user. You can have a number of words in an array then for each game, pull a random word out of the array, break it up into the letter array then test. For the polynomial I would use a struct. struct spolynomial { int coefficient; int exponent; } Declare a struct array if that is allowed in Python. It is allowed in C++. spolynomial polynomial[10]; To differentiate: polynomial[0].coefficient = polynomial[0].coefficient * polynomial[0].exponent polynomial[0].exponent = polynomial[0].exponent -1 You will have to obviously put in an appropriate test for when you come up against an exponent < 2 which will need different actions for differentiation.

OpenStudy (mandre):

Correction, not necessarily different actions for differentiation, but different output. 6x^0 should be replaced by 6 only, obviously.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!