Tag Archives: #11209099

#WSQ14

 

Hi, I have finished my wsq14, so it had a part I didn’t (maybe don’t) understand at all but I could achieve it by checking the link http://stackoverflow.com/questions/11208971/round-a-float-to-a-given-precision/11209099#11209099, furthermore in this wsq I could take a part of a previous activity, well I will leave my code in the next link:

 

https://www.dropbox.com/s/cvigigh61tv2sdh/wsq14.cpp?dl=0

#WSQ14

 

Hi, I have finished my wsq14, so it had a part I didn’t (maybe don’t) understand at all but I could achieve it by checking the link http://stackoverflow.com/questions/11208971/round-a-float-to-a-given-precision/11209099#11209099, furthermore in this wsq I could take a part of a previous activity, well I will leave my code in the next link:

 

https://www.dropbox.com/s/cvigigh61tv2sdh/wsq14.cpp?dl=0

#WSQ14

In this program you need to estimate the constant “e”, to do this you need to ask the user the number of decimals points, and that will be your precision.

If you want to know about the formula that we are going to use and things about that, you can check this page: http://www.iboenweb.com/ibo/docs/Demostracion%20de%20Formula%20de%20Euler.htm

To organize the program I created a function called factorial, to calculate the factorial that will be introduced in the function calculateE.

The function calculateE is float, because is going to return a non integer number.

The loop do-while, inside the function calculateE, is useful to add the value according with the formula, but this loop will depend by the precision that the user wants.

Finally, you need to truncate the number calculated depending by the precision asked.

Here you can see my code and the program working.

If you don’t know how to round a float, you can check this page: http://stackoverflow.com/questions/11208971/round-a-float-to-a-given-precision/11209099#11209099

Also, here you can find my code:

GitHub: https://github.com/taniaprogram/SolvingProblemsWithProgramming/blob/master/Euler.cpp

Google Drive: https://drive.google.com/file/d/0B-NM4ghaDXBvUEw5RE9nTVZrTjQ/view?usp=sharing

WSQ14 – Calculate e

Hey everybody! In this time, we wrote a code to calculate Euler’s constant or e number. That part was simple, the problem came when we need to stop the programm when we have the precision (decimal point numbers) that we required. To acomplishied that, we use a function called floor which we take from here

http://stackoverflow.com/questions/11208971/round-a-float-to-a-given-precision/11209099#11209099

Anyway, here is the link to my code. Enjoy it!

https://github.com/juanpsantana/WSQs/blob/master/WSQ14.cpp