Find Jobs
Hire Freelancers

Continued Fraction C++ program

€8-30 EUR

Folyamatban
Kiadva ekkor: több mint 5 évvel ezelőtt

€8-30 EUR

Teljesítéskor fizetve
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> .
Projektazonosító: 18174580

A projektről

2 ajánlat
Távolról teljesíthető projekt
Aktiválva: 5 évvel ezelőtt

Szeretne pénzt keresni?

A Freelancer oldalán történő árajánlatadás előnyei

Határozzon meg költségvetést és időkeretet
Kapja meg fizetését a munkáért
Vázolja ajánlatát
Ingyen regisztrálhat és adhat árajánlatot munkákra
2 szabadúszó adott átlagosan €34 EUR összegű árajánlatot erre a munkára
Felhasználó avatár
I'm good in math, will do it in 1 day ************************************ ************************************
€29 EUR 1 napon belül
0,0 (0 értékelés)
0,0
0,0

Az ügyfélről

GERMANY zászlója
duisburg, Germany
5,0
1
Fizetési mód hitelesítve
Tagság kezdete: nov. 16, 2018

Ügyfél-hitelesítés

Köszönjük! E-mailben elküldtük a linket, melyen átveheti ajándék egyenlegét.
E-mailje elküldése során valami hiba történt. Kérjük, próbálja újra.
Regisztrált Felhasználók Összes Közzétett Munka
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Előnézet betöltése
Hozzáférést adott a helymeghatározáshoz.
Belépési munkamenete lejárt, és kijelentkeztettük. Kérjük, lépjen be újra.