????? ?????????????, ???????????? ????? CyberForum.ru
???? ????????

??? ??????? ????????? output ???????? - C++

?????
???????????
???????????? ??????
?????? ???? ???????
C++ ?????? ? ??????? ? ?/C++ http://www.cyberforum.ru/cpp-beginners/thread105800.html
??????! ????? ?????? ???????????) ??????????, ??????????, ??? ?? ????? filename.txt, ? ??????? ?????????? ??????? ?? 1000 ?? 5, ???????? ???????? ? ??????? M, M, M, M, M ? ? ?????? ?? ??? ?????...
C++ ??????? ?????? ??? ???????. ???? c??????? ???????????? ?????, ? ?????? – ???????? ?? ??? ??????. ??????? ?? ????? ?????? ???, ??? ???????????? ??????, ???? ??????? P ??????. ??? ?????????? ?????? ?? 10... http://www.cyberforum.ru/cpp-beginners/thread105797.html
C++ ?????????? ????????? ???????
? ???? ???? ???????, ? ??????? ? ?????? ?????? char. ??? ????? ??????? ???, ????? ???-?? ????????? ??????? ???????? ?? ???????? ?????? ?????????? (int). ? ??????? function (int a) { char...
?????????????? ????????. C++
???? ? ???? ??????? ?????????? ????????? ?? ?????? char ??????? (??? ???????), ?? ??? ??? ?????? ? ????????? ??????????: char function() ??? char* function() ?
C++ ????? ????? ?? ??????? ? ?????????? ????????????? ????????? http://www.cyberforum.ru/cpp-beginners/thread105752.html
???????? ?????????? ? ???????? ?????, ??? ?????? ?? ????? ???????????????? ?++... Matrix26. ???? ??????? ??????? M × N. ????? ????? ?? ??????? ? ?????????? ????????????? ????????? ? ??????? ??????...
C++ ??????? C++ ?????? ????! ?????, ????? ????????: ??? ????? ???-?? ?????????? ? C++, ?? #include <graphics.h> ?? ???????? - ?? ?? ?? ???????, ?????, ??? ?????????? ?? ???????! ??? ??? ??????, ????? ?????????? C++... ?????????

???????? ????????? ????????
ISergey
Maniac
??????? ?++
1376 / 887 / 53
???????????: 02.01.2009
?????????: 2,663
??????? ? ?????: 1
18.03.2010, 01:43
??? ????????..
C++
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
#include <iostream>
#include <ostream>
#include <fstream>
#include <vector>
 
template <typename _Elem, typename _Traits>
class b_coutf_{
 
public:
    void push_back(std::basic_ostream<_Elem, _Traits> &rhs){
        _out.push_back(&rhs);
    }
    ~b_coutf_(){
        _out.clear();
    }
 
    template<typename T>
    friend b_coutf_ & operator << (b_coutf_ &lhs, const T& rhs){
        typename std::vector<std::basic_ostream<_Elem, _Traits>* >::iterator i;
        i = lhs._out.begin();
        for(; i != lhs._out.end(); ++i)
            (*(*i)) << rhs;
        return lhs;
    }
private:
    std::vector<std::basic_ostream<_Elem, _Traits>* > _out;
};
 
 
typedef b_coutf_<char, std::char_traits<char> > coutf_;
 
 
int main(){
 
    coutf_ coutf;
    std::ofstream file("file.txt");
    
    coutf.push_back(std::cout);
    coutf.push_back(file);
 
    coutf << "Testing...\n" << 123 << '\n';
 
    file.close();
 
    return 0;
}
http://codepad.org/JDqHebSn
1
 
?????????? - ????? ?????????????, ???????????? ?????, ????????????????
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
???????@Mail.ru