-
Notifications
You must be signed in to change notification settings - Fork 0
/
BigReal.h
49 lines (43 loc) · 1.72 KB
/
BigReal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// FCAI – Object-Oriented Programming – 2022 - Assignment 2
// Program Name: BigReal
// Last Modification Date: 5/11/2022
// Author1 : Mario Malak Alabd, ID: 20210313, Section : 5
// Author2 : Kirolos Osama Adib, ID: , Section : 5
// Author3 : Ehab Ashraf, ID: , Section : 5
/*
description: In this problem we developed new class Big Real.
that can hold unlimited real values and performs arithmetic operations on them.
such as: +, -, <, and >.
*/
#ifndef BIGREALV3_BIGREAL_H
#define BIGREALV3_BIGREAL_H
#include "BigDecimalIntClass.h"
class BigReal {
private:
BigDecimalInt decimalPart;
BigDecimalInt floatPart;
char Sign;
static bool checkValidInput(string realNumber);
void addFloatParts(BigReal &real1, BigReal &real2, BigReal &answer);
void subtractFloatParts(BigReal &real1, BigReal &real2, BigReal &answer);
string completeWithZeroes(string str, int len);
void removeZeroes(BigReal &number);
public:
BigReal (double realNumber = 0.0); // Default constructor
BigReal (string realNumber);
BigReal (BigDecimalInt bigInteger);
BigReal (const BigReal& other); // Copy constructor
BigReal (BigReal&& other); // Move constructor
BigReal& operator= (BigReal& other); // Assignment operator
BigReal& operator= (BigReal&& other); // Move assignment
BigReal operator+ (BigReal& other);
BigReal operator- (BigReal& other);
bool operator< (BigReal anotherReal);
bool operator> (BigReal anotherReal);
bool operator== (BigReal anotherReal);
int size();
int sign();
friend ostream& operator << (ostream& out, BigReal num);
friend istream& operator >> (istream& out, BigReal& num);
};
#endif //BIGREALV3_BIGREAL_H