diff --git a/pr6.cpp b/pr6.cpp index c61f0d8..1d777c1 100644 --- a/pr6.cpp +++ b/pr6.cpp @@ -4,9 +4,24 @@ #include #include #include +#include using namespace std; +// Манипулятор для вывода в научном формате +template +ostream& scientific_format(ostream& os, const T& value) { + os << std::scientific << value; + return os; +} + +// Манипулятор для вывода в 8-ричной системе счисления +template +ostream& octal_format(ostream& os, const T& value) { + os << std::oct << value; + return os; +} + template class Element { protected: @@ -364,7 +379,7 @@ public: } return os; } - + // Overloading the subscript operator T& operator[](int index) { if (index < 0 || index >= this->count) { @@ -431,7 +446,9 @@ public: friend ostream& operator<<(ostream& os, const StateList& stateList) { Element* current = stateList.stateList.getHead(); while (current != nullptr) { - os << current->getInfo() << endl; + //os << current->getInfo() << endl; + // Выводим элемент в научном виде и в 8-ричной системе счисления + os << scientific << current->getInfo() << " " << oct << current->getInfo() << endl; current = current->getNext(); } return os;