Banana

With great strength come great bananas. “Banana” by Apionid. Link:  https://www.flickr.com/photos/apionid/16138060480/

Question #1:

  • Write a function called calculateE that receives a single float parameter accuracy and calculates the value of e using using sufficient terms ) until the difference between two successive calculations differ by LESS than the parameter accuracy.

Oh boy, this sounds good already!

This was the easier question, no doubt. Checking for help in some websites, such as Stack Overflow and Cplusplus.com everything was clear.

GitHub code Link for Question 1.

Question #2:

  • Write a function called checkBanana that receives a single parameter of type string that is the name of a file in the same directory as the program. The function opens that file of text and counts the number of times that the string “banana” appears. For full marks it should ignore case (so count Banana, BANANA, bAnAnA regardless of mix of upper and lower case characters).
    • To test your program, create your own file to test with in the same directory as your program.

Welp, this was a lot more interesting. Handling files and data is very important in programming, and again, going to Stack Overflow and Cplusplus.com helped, though some of the explanations were far too complicated for my liking, so I turned to Tutorials Point for reference on files and streams.

GitHub code Link for Question 2.

CC BY 4.0 Quiz 11 by Alan S. Olalla is licensed under a Creative Commons Attribution 4.0 International License.