-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConvertNumbers.h
More file actions
49 lines (42 loc) · 1.15 KB
/
Copy pathConvertNumbers.h
File metadata and controls
49 lines (42 loc) · 1.15 KB
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
//---------------------------------------------------------------------------
#ifndef ConvertNumbersH
#define ConvertNumbersH
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <sstream>
#include <math.h>
#include <limits.h>
//---------------------------------------------------------------------------
class TConvertNumbers
{
private:
int max_len;
std::string Result;
enum Numerical_Signs {
DEC='D',
HEX='H',
BIN='B',
OCT='O'
} Signs;
bool CheckConversion(long int nr);
bool Parse(std::string sToParse);
bool dec2bin(std::string sNumber);
bool dec2hex(std::string sNumber);
bool dec2oct(std::string sNumber);
bool hex2dec(std::string sNumber);
bool hex2bin(std::string sNumber);
bool hex2oct(std::string sNumber);
bool bin2dec(std::string sNumber);
bool bin2hex(std::string sNumber);
bool bin2oct(std::string sNumber);
bool oct2dec(std::string sNumber);
bool oct2hex(std::string sNumber);
bool oct2bin(std::string sNumber);
public:
TConvertNumbers(void);
virtual ~TConvertNumbers(void);
bool Convert(std::string sToParse, std::string& sResult);
};
#endif