codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
// --- StdAfx.h --- #include <stdio.h> #include <tchar.h> #include <locale> #include <string> #include <iostream> #include <fstream> #define НАЧАЛО \ int _tmain(int argc, _TCHAR* argv[]) {\ std::locale::global(std::locale(""));\ std::streambuf *cons_buf = std::cout.rdbuf();\ class out2file {\ std::ofstream of_;\ public:\ out2file& operator=(const char* f) {\ of_.open(f);\ std::cout.rdbuf(of_.rdbuf());\ return *this;\ }\ } o2f; #define КОНЕЦ return 0; } #define ПРОГРАММЫ #define Выведи #define текст #define на #define экран std::cout.rdbuf(cons_buf); #define в #define файл o2f = #define начало ;std::cout << #define конец ; #define текста // --- main.cpp --- // Компилировать: // MSVC c ключем /FI "StdAfx.h" // GCC c ключем -include "StdAfx.h" // ---------------- НАЧАЛО ПРОГРАММЫ Выведи текст на экран начало текста "Я помню чудное мгновенье: \n\ Передо мной явилась ты, \n\ Как мимолетное виденье, \n\ Как гений чистой красоты." конец текста Выведи текст в файл "Стих.txt" начало текста "В томленьях грусти безнадежной\n\ В тревогах шумной суеты,\n\ Звучал мне долго голос нежный\n\ И снились милые черты." конец текста КОНЕЦ ПРОГРАММЫ
Private
[
?
]
Run code
Submit