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

正文內(nèi)容

第9章c的輸入和輸出(參考版)

2024-08-01 23:52本頁面
  

【正文】 coutcontents。 (0,ios::beg)。)。 // 設(shè)置寫指針 (39。 // 以讀寫方式打開文件 if (()) coutopen file errer!。 include include void main(void) { fstream fs。 另一個名字叫做 put指針,用于指出下一次輸出操作的位置。 … if (!()) //尚未到達(dá)文件尾 … (4) 文件的隨機(jī)讀寫 在 C++的 I/O系統(tǒng)中有個文件指針,它有兩個名字。該函數(shù)的原型是 : int eof()。如果該函數(shù)的返回值非零,表示到達(dá)文件尾。 } (3) 檢測文件結(jié)束 在文件結(jié)束的地方有一個標(biāo)志位,記為 EOF(End OF)。 ()。 ((char *) amp。 ((char *) amp。 } int i=12340。 if (!out) { coutCannot open output file.\n。 例 912 用 write()函數(shù)向文件 test中寫入整數(shù)與雙精度數(shù) 。 ostream amp。 } (2) 用 read()函數(shù)和 write()函數(shù)讀寫二進(jìn)制文件 read()和 write()原型如下 : istream amp。 } void main() { test_write()。 char c。 c++。i26。a39。 int i。 例 將 ‘ a’ 至 ‘ z’ 的 26個英文字母寫入文件 , 而后從該文件中讀出并顯示出來 。 put(char ch)。 get()函數(shù)從相關(guān)流中只讀一個字節(jié),并把該值放入ch中并返回該流,當(dāng)?shù)竭_(dá)文件尾時,使該流的值為 0。 get(charamp。 return 0。 } fout10 \ This is a text file.\\n。 if (!fout) { coutCannot open output file\n,。 例 把一個整數(shù)、一個浮點(diǎn)數(shù)和一個字符串寫到磁盤文件 test中。 將關(guān)閉與流 out相聯(lián)接的文件。關(guān)閉文件可使用 close()函數(shù)完成,close()函數(shù)也是流類中的成員函數(shù),它不帶參數(shù),不返回值。 在使用完一個文件后,應(yīng)該把它關(guān)閉。 (3) 使用 open()函數(shù)打開文件,也就是使某一文件與上面的某一流相聯(lián)系。 分別定義了輸入流對象 in。 ofstream out。 (2) 建立流。關(guān)閉一個文件,就是取消這種關(guān)聯(lián)。在使用結(jié)束后,則應(yīng)“關(guān)閉”文件。 // 輸出對象 obj的成員值 ( 新值 ) return 0。 // 輸出對象 obj的成員值 cinobj。 } main() { three_d obj(10,20,30)。 input。 input。 input, three_damp。 } istreamamp。 outputendl。 ob) { output,。 operator(ostreamamp。 }。 ob)。 operator(istreamamp。 ob)。 operator(ostreamamp。 z=c。 include class three_d { public: three_d(int a,int b,int c) { x=a。 return 0。 } main() { coord a(55,66), b(100,200)。 ob) { stream,endl。 operator(ostreamamp。 }。 stream,coordamp。} friend ostreamamp。 public: coord(int i=0,int j=0) { x=i。 } 例 輸出運(yùn)算符 “ ”重載 。 . . . in。 obj) { in。 operator(istreamamp。 return out。 out。 out, class_nameamp。 } 重載輸出運(yùn)算符 “ ” 定義輸出運(yùn)算符“ ”重載函數(shù)的一般格式如下 : ostreamamp。 cout***hexi***deci***endl。 } int main() { int i。 coutEnter numbe
點(diǎn)擊復(fù)制文檔內(nèi)容
規(guī)章制度相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1