Færdiggjort

Continued Fraction C++ program

i wanna a program that execute a regular continued fraction for any real valued number x is defined by the formula above and can be written in a short form with squared brackets x=[f0;f1,f2,f3,…].

Task is to represent this short form for continued fractions inside a computer by lists of integer numbers, to input, calculate and also delete them; no global variables shall be defined and used.

the code must be as the following steps :-

1- Define a structure for above list elements to implement continued fraction by lists with these elements.

2- Define a function with a continued fraction cf=[f0;f1,f2,f3,…,fk] as pointer/list as first and a natural/integer number fk+1 as second parameter extending the continuous fraction to cf=[f0;f1,f2,f3,…,fk,fk+1], i.e. appending a further element with value fk+1 at the end of the list. Return the extended continued fraction/the resulting list as function value.

3- Define a function with a continued fraction as pointer parameter deleting the complete list, freeing the memory of all list elements on the heap. Output like in the examples below all deleted values fk to check your function.

4-Define a function with a continued fraction as pointer parameter returning its value as a double coded floating point value.

Hint: a recursive solution is especially appropriate and short in this case.

5 - Write a function without parameter, first reading f0∈Z, then in a loop the values fk∈N, k=1,2,…, successively constructing the continued fraction as list and return it.

6 - Write a main function and define three pointer variables for continued fractions. Initialise the first above example cf1=123100=[1;4,2,1,7] and the second cf2=1710=[1;1,2,3] by appropriate nested functions calls directly in code. Input the third continued fraction cf3 by giving a function call to above defined function (task 5).

For all three continued fractions output its floating point values calculated by respectively given function calls (task 4) with at least 15 digits after the decimal point and then delete the memory in heap for the continued fractions/lists also by appropriate function calls (task 3; see also examples below).

Test your program at least for inputs 1=[1], 2=[1;1], 0.5=[0;2], 2–√≈[1;2,2,2,2,…] and π≈[3;7,15,1,292,1,1,1,2,1,3,1,…], find further examples here.

ps: Only use C++ input and output, no calls of scanf or printf function or malloc, calloc, ... or free!

don't include any libraries more than <iostream> .

Evner: C programmering, C++ Programmering

Se mere: continued fractions python, rosetta code continued fraction, continued fraction fortran, numpy continued fraction, types of continued fractions, python continued fraction convergents, continued fraction recursion c++, continued fraction algorithm, fraction calculator program, sas program sql loop, fraction fraction addition program, fraction class program, fraction java program, c program of a small job for university, c program operating system, c program outsources, c program to show encryption and attacking, c program, c# program, c++ program outsources

Om arbejdsgiveren:
( 0 bedømmelser ) Duisburg, Germany

Projekt ID: #18174580

Tildelt til:

asadullahjobs7

Hello i saw your project. I want to do it. More discussion on chat? I try my best to give you good result.

€8 EUR på 1 dag
(2 bedømmelser)
0.8

3 freelancere byder i gennemsnit €25 på dette job

yuwy

I'm good in math, will do it in 1 day ************************************ ************************************

€29 EUR på 1 dag
(0 bedømmelser)
0.0
€38 EUR på 1 dag
(0 bedømmelser)
0.0