ostream

    0熱度

    1回答

    從boost iostreams tutorial我已閱讀,也可以使用升壓stream_buffer用的std :: ostream的,如圖教程: #include <ostream> #include <boost/iostreams/device/file.hpp> #include <boost/iostreams/stream.hpp> namespace io = boost::

    1熱度

    1回答

    我正在C++的一個介紹級別課程上進行測驗,我試圖理解一個問題。在搜索了互聯網並沒有得到答案之後,我就在這裏。 Which of the following function declarations will accept either cout or a file stream object as its argument? A. void output(fstream &outFile)

    0熱度

    1回答

    我想添加顯示對象的年齡,但我不知道如何在函數ostream中調用對象日期,因爲它只需要兩個參數。有什麼建議麼?? 我是否需要創建一個虛擬操作符並繼承Date? #ifndef HEARTRATE_H #define HEARTRATE_H #include <string> #include <iostream> #include "Date.h" using std::string;

    1熱度

    1回答

    我想用std::ostream這樣的: int main() { std::ostream os; os << "something ..." << std::endl; return 0; } 有一個錯誤說,ostream的構造保護: error: ‘std::basic_ostream<_CharT, _Traits>::basic_ostream() [

    12熱度

    1回答

    在我看來,在C++標準中,特別是在C++ 17草案(N4659)的§30.7.5.2.4中,關於何時字符在輸出流的格式化輸出操作中變寬(operator<<() )。完全相同的不一致似乎反映在en.cppreference.com中。 首先,假設以下的聲明: std::ostream out; std::wostream wout; char ch; wchar_t wch; const

    -5熱度

    2回答

    在編寫下面的代碼,我得到一個錯誤: Expression.h class Expression{ ... protected: std::ostream Os; }; Expression.c Expression::Expression() : Os(std::cout) { ... } Expression::Expression(std::ofs

    10熱度

    1回答

    根據C++標準(§30.7.5.2.4C++ 17草案(N4659)的),out << ch不會在ch執行加寬操作中,如果ch是char和out是std::ostream。 這是否意味着std::ctype<char>::widen()(即,char - >char)由標準保證是在基本的源字中的所有字符的標識功能(widen(ch) == ch)設置? 如果是這樣,這反過來是否意味着標準要求所有區

    0熱度

    1回答

    我對理解什麼是ostream是一個基本問題。我知道它是輸出流的基類,但是我不能很好地使用它,以及爲什麼要使用它而不是僅僅說std :: cout。 所以在這裏我有這個例子,我必須創建一個新的類名爲堆棧與pop()函數(就像在C++已經提供的類)。 這裏list_node是一個由兩個元素組成的結構體:鍵(它是一個整數)和一個指向下一個整數的interator。 list_node(已給)的 定義:

    0熱度

    1回答

    我試圖在files.cpp即需要3個 參數創建一個函數getIdFromFile:(一C++串表示一個文件名,一個IStream,和一個ostream),並返回一個int。 這是啓動代碼,我有: // files.cpp #include "files.hpp" #include <iostream> #include <fstream> using std::ofstream; usi

    -1熱度

    1回答

    do { std::cout << "Enter a valid name" << std::endl; std::cin >> name; } while (!validName(name) && std::cout << "It is not a valid name" << std::endl); 這是一個很好的做法,如果名稱無效,那麼我用這種方式回答一條線?