Hello people, im basically looking for a method to create a class called "real_no" which has the capacity to store numbers as they are.

i.e if the input is given as 2 + Root(2) then i should be able to store it as 2 + Root(2) and not 3.414. also, i would like it to be a structure where it is possible to carry the operations of + - * / with relative ease. with 2+ Root(2) the problem is pretty simple. but what of a number like

Root(2+root(109^{2/3})) here the problem starts getting a bit complex.


      23 + 55^{2/3}

also what if there is a root inside a root inside a root etc. like Root(3 - Root(4 + Root(5))) so basically im looking for a storge and retrieval structure which will enable me to operate such data.

if not then can anyone suggest a method by which recursive data storage can be acheived ion C++? i.e supposing I create a class of type A then i would like to store an object or a pointer or something to another object of type A as a data member of class A.


6 Years
Discussion Span
Last Post by maharjun

And this is supposed to be your second post?.. Always read the rules before you post. We don't DO your assignments for you.. we help you with them, so post your efforts and let's see what you've done with the problem...

Edited by tkud: n/a


Im sorry if it appeared as if i was looking for a solution to my assignment. the assignment was actually just posted so that a person gets the idea of what im trying to do. it was basically to avoid any confusion that may have been created.what i was really interested in was whether there is any standard structure that people use to recursively store data. <see heading> for clarity in what i mean by recursive storage, please refer to last section of my post. i tried initializing a data-member within my class real_no of type real_no and it didnt compile. so i wanted to know if there is any trick to acheive the same or similar effect using another route?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.