freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c++畢業(yè)論文外文翻譯(文件)

2025-06-11 19:20 上一頁面

下一頁面
 

【正文】 lass of ifstream and istringstream. It is also the base class for iostream, which in turn is the base class for sstream and fstream classes. Because the types ifstream and istringstream inherit from istream, we already know a great deal about how to use these types. Each program we39。 2020 年畢業(yè)設(shè)計論文英漢互譯部分 Chapter 8. The IO Library In C++, input/output is provided through the library. The library defines a family of types that support IO to and from devices such as files and console windows. Additional types allow strings to act like files, which gives us a way to convert data to and from character forms without also doing IO. Each of these IO types defines how to read and write values of the builtin data types. In addition, class designers generally use the library IO facilities to read and write objects of the classes that they define. Class types are usually read and written using the same operators and conventions that the IO library defines for the builtin types. This chapter introduces the fundamentals of the IO library. Later chapters will cover additional capabilities: Chapter 14 will look at how we can write our own input and output operators。ve written that read an istream could be used to read a file (using the ifstream type) or a string (using the istringstream type). Similarly, programs that did output could use an ofstream or ostringstream instead of ostream. In addition to the istream and ostream types, the iostream header also defines the iostream type. Although our programs have not used this type, we actually know a good bit about how to use an iostream. The iostream type is derived from both istream and ostream. Being derived from both types means that an iostream object shares the interface of both its parent types. That is, we can use an iostream type to do both input and output to the same stream. The library also defines two types that inherit from iostream. These types can be used to read or write to a file or a string. Using inheritance for the IO types has another important implication: As we39。 standard output is wcout。標(biāo)準(zhǔn)庫定義了一族類型,支持對文件和控制窗口等設(shè)備的讀寫( IO)。類類型通常使用 IO 標(biāo)準(zhǔn)庫為內(nèi)置類型定義的操作符和規(guī)則來進(jìn)行讀寫。 ? cin (發(fā)音為 seein):讀入標(biāo)準(zhǔn)輸入的 istream 對象。 ? 操作符,用于從 istream 對象中讀入 輸入。 附錄 A 會介紹如何控制 IO 操作的格式、文件的隨機訪問以及無格式的 IO。 . 面向?qū)ο蟮臉?biāo)準(zhǔn)庫 迄今為止,我們已經(jīng)使用 IO 類型和對象讀寫數(shù)據(jù)流,它們常用于與用戶控制窗口的交互。 從概念上看,無論是設(shè)備的類型還是字符的大小,都不影響需要執(zhí)行的 IO 操作。為了管理這樣的復(fù)雜性,標(biāo)準(zhǔn)庫使用了 繼承( inheritance)來定義一組 面向?qū)ο螅?objectoriented) 類。 C++ 中所提及的父類稱為 基類( base class) ,而繼承而來的類則稱為 派生類( derived class) 。繼承關(guān)系通??梢杂妙愃朴诩彝涞膱D解說明。我們曾經(jīng)編寫過的讀 istream 對象的程序也可用于讀文件(使用 ifstream 類型 )或者 string 對象(使用 istringstream 類型)。 iostream 類型由 istream 和 ostream 兩者派生而來。這些類型可用于讀寫文件或 string 對象。類似地,形參為 ostreamamp。此外,標(biāo)準(zhǔn)庫還定義了一組相關(guān)的類型,支持 wchar_t 類型。而 wchar_t 版本的 string 輸入/輸出流則是 wistringstream、 wostringstream 和 wstringstream?;诹鞯? wchar_t 類型的類和對象在 iostream 中定義,寬字符文件流類型在 fstream 中定義,而寬字符 stringstream 則在 sstream 頭文件中定義。正如在 第九章 看到的,只有支持復(fù)制的元素類型可以存儲在 vector 或其他容器類型里。 一般情況下,如果要傳遞 IO 對象以便對它進(jìn)行讀寫,可用非 const 引用的方式傳遞這個流對象。 實現(xiàn) IO 的繼承正是錯誤發(fā)生的根源。 如果在標(biāo)準(zhǔn)輸入設(shè)備輸入 Borges,則 cin 在嘗試將輸入的字符串讀為 int 型數(shù)據(jù)失敗后,會生成一個錯誤狀態(tài)。檢測流是否用的最簡單的方法是檢查其真值 。而某些程序則需要更詳細(xì)地訪問或控制流的狀態(tài),此時,除了知道流處于錯誤狀態(tài)外,還必須了解它遇到了哪種類型的錯誤。該狀態(tài) 成員以二進(jìn)制位( bit)的形式使用,類似于 第 節(jié)的例子中用于記錄測驗成績的 int_quiz1 變量。如果出現(xiàn)了這類錯誤,則該流通常就不能再繼續(xù)使用了。如果 bad、 fail 或者 eof 中的任意一個為 true,則檢查流本身將顯示該流處于錯誤狀態(tài)。在流的使用出現(xiàn)了問 題并做出補救后,如果我們希望把流重設(shè)為有效狀態(tài),則可以調(diào)用 clear 操作。 多種狀態(tài)的處理 常常會出現(xiàn)需要設(shè)置或清除多個狀態(tài)二進(jìn)制位的情況。對于結(jié)果中的每一個二進(jìn)制位,如果其值為 1,則該操作的兩個操作數(shù)中至少有一個的對應(yīng)二進(jìn)制位是 1。另外一種方法則是使用按位或( OR)操作符( 第 節(jié) )在一次調(diào)用中生成 “ 傳遞兩個或更多狀態(tài)位 ” 的值。除了添加的標(biāo)記狀態(tài), setstate 將保留其他已存在的狀態(tài)變量不變。 clear 和 setstate 操作用于改變條件成員的狀態(tài)。 eofbit 是在遇到文件結(jié)束符時設(shè)置的,此時同時還設(shè)置了 failbit。這些常量值用于指出特定類型的 IO 條件,可與位操作符 ( 第 節(jié) )一起使
點擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1