- #1

diredragon

- 323

- 15

**Create a class**

Implement a constructor

Create two class functions (methods) that given the number

Function prototypes:

Note: No vectors and no library other than <iostream> allowed.

*DecimalN*which holds decimal numbers using dynamic arrays.Implement a constructor

*DecimalN::DecimalN(char* decimal)*so that it can be created like for example*DecimalN number("23.5698")*.Create two class functions (methods) that given the number

*n*it shift the number n places to the right or left depending on the function.Function prototypes:

**DecimalN**DecimalN::moveleft(int n); // left**DecimalN****DecimalN**::moveright(int n); // rightNote: No vectors and no library other than <iostream> allowed.

Here is my work:

Code:

```
#include <iostream>
using namespace std;
class DecimalN {
int *whole, *fraction; //Array that keeps the parts of the number as digits
int lng_whole, lng_frac; //Lengths of those parts.
char sign; //Possibly to know the sign of the function if added like "+3.45"
public:
DecimalN(char* decimal); //This function works properly so take it as doing everything fine and given then number eg. 45.890
//makes whole = [4,5] and fraction = [8,9,0]
~DecimalN() { delete[] whole; delete[] fraction; }; //Destructor
DecimalN moveleft(int n); //The part which i need to write.
};
```