/////////////////////////////////////////////////////////// // Проект Task4_1a /////////////////////////////////////////////////////////// // CyrIOS.h #ifndef CYR_IOS_H #define CYR_IOS_H #include #include #include #include using namespace std; #define MAX_STR_LEN 4096 // Класс CyrOstream class CyrOstream : public ostream { public: CyrOstream(_Uninitialized no_init) : ostream(no_init) {} CyrOstream& operator <<(const char*); private: char buf_[MAX_STR_LEN]; }; extern CyrOstream Cout; #endif /* CYR_IOS_H */ #ifndef CYR_IOS_IMPLEMENTATION // 1 #define cout Cout // 2 #endif // 3 /////////////////////////////////////////////////////////// // CyrIOS.cpp #define CYR_IOS_IMPLEMENTATION // 4 #include "CyrIOS.h" // Класс CyrOstream CyrOstream& CyrOstream::operator <<(const char* s) { int n = strlen(s); strncpy(buf_, s, n); buf_[n] = 0; CharToOem(buf_, buf_); cout << buf_; return *this; } // Глобальный объект для вывода CyrOstream Cout(_Noinit); // 5 ////////////////////////////////////////////////////////// // Task4_1a.cpp #include "CyrIOS.h" int main() { cout << "Добро пожаловать в C++!"; // 6 cout << endl; // 7 return 0; } //-------------- конец проекта Task4_1a ---------------- //////////////////////////////////////////////////////////