35 lines
762 B
C++
Executable File
35 lines
762 B
C++
Executable File
#ifndef __ROMAN_H
|
|
#define __ROMAN_H
|
|
|
|
#ifndef __OBJECT_H
|
|
#include <object.h>
|
|
#endif
|
|
|
|
class TRoman : public TObject
|
|
{
|
|
word _value;
|
|
|
|
protected:
|
|
word ctoi(char c) const;
|
|
const char * itor(word) const ;
|
|
word rtoi (const char *) const ;
|
|
void print_on (ostream& of) const { of << itor(_value) ; }
|
|
|
|
public:
|
|
operator const char * () const { return itor(_value); }
|
|
operator word() const { return _value; }
|
|
|
|
TRoman& operator = (const TRoman& rom) { _value = rom._value; return *this; }
|
|
TRoman& operator = (word num) { _value = num; return *this; }
|
|
TRoman& operator = (const char * val) { _value = rtoi(val); return *this;}
|
|
|
|
TRoman (int num = 0) { *this = num; }
|
|
TRoman (const char * val = "") { *this = val; }
|
|
virtual ~TRoman () {}
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|