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

正文內(nèi)容

[工學(xué)]c程序設(shè)計(jì)課件第4章(參考版)

2024-10-21 23:33本頁面
  

【正文】 } 執(zhí)行程序時(shí),若輸入數(shù)據(jù)為: 200 50↙ 則程序輸出結(jié)果:¥ 200元 50分 。 coutm。 cout輸入兩個(gè)整數(shù): 。 return is。 is,CMoneyamp。 } istreamamp。 m) 2021/11/10 53 重載插入和提取運(yùn)算符 { os¥ 元 \t分 \n。 operator(ostreamamp。 }。Cents=c。)。 operator(istreamamp。)。 operator(ostreamamp。 【 例 】 重載提取和插入運(yùn)算符,直接輸入輸出對(duì)象。 } 該程序的運(yùn)行結(jié)果: Ab108+506,446*55525/ad763,WfR40jjf:kk{63。 coutb。字符和 //一個(gè)字符串結(jié)束符 39。 //向 sout流輸出作為結(jié)束符的 39。$39。 //將 x輸出到字符串流 sout中 } (ch)。 soutx39。99}$ 2021/11/10 51 字符串流 sinx。 ch=57) { (ch)。) { if(ch=48 amp。 while(ch!=39。 39。//定義一個(gè)輸出字符串流 sout,使用 b數(shù)組 2021/11/10 50 字符串流 (a,sizeof(a))。 istrstream sin(a)。 include void main() { char a[50]。字符串從鍵盤輸入。 strstream類提供的構(gòu)造函數(shù)的原型為: strstream::strstream(char*buffer,int n,int mode)。 istrstream::istrstream(char*buffer,int n)。 ostrstream類提供的構(gòu)造函數(shù)的原型為: ostrstream::ostrstream(char*buffer,int n,int mode=ios::out)。 } ()。 coutx39。i++) { ((char*)amp。amp。 //文件指針移到指定位置 for(i=0。 return。 2021/11/10 47 文件的隨機(jī)訪問 ifstream f(,ios::in|ios::binary)。i,sizeof(int))。i200。return。 ofstream out(,ios::out|ios::binary)。 //返回當(dāng)前文件讀寫位置 2021/11/10 46 文件的隨機(jī)訪問 【 例 】 將 5~200之間的奇數(shù)存入二進(jìn)制文件,然后再將文件中的第 30~39位置之間的數(shù)依次讀出并輸出。 ostream::seekp(streamoff,ios::seek_dir)。 ostream::seekp(streampos)。 //相對(duì)定位 streampos istream::tellg()。 //絕對(duì)定位,相對(duì)于文件頭 istreamamp。 } 運(yùn)行結(jié)果: 3 4 10 20 30 40 50 2021/11/10 44 文件的隨機(jī)訪問 C++把文件看作有序的 n個(gè)字節(jié)的流 2021/11/10 45 文件的隨機(jī)訪問 ? 對(duì)于輸入流來說,用于文件讀寫位置定的成員函數(shù)有: istreamamp。 cout程序執(zhí)行完畢! \n。i++)//顯示整數(shù) { coutint_arr[i] 。 for(i=0。i++)//顯示浮點(diǎn)數(shù) { coutfloat_arr[i] 。 2021/11/10 43 二進(jìn)制文件的輸入/輸出(讀寫) for(int i=0。int_arr,sizeof(int_arr))。float_arr,sizeof(float_arr))。 return。 ifstream in()。i_number,sizeof(i_number))。f_number,sizeof(f_number))。 return。 ofstream out()。 int int_arr[5]。 include include void main() { int i_number[5]={10,20,30,40,50}。 cout\n程序執(zhí)行完畢! \n。i,sizeof(int))。i100。return。 include void main(void) { ofstream out(,ios::out|ios::binary)。 ostream::write(const signed char*t, int n)。 ostream::write(const unsigned char*t, int n)。 ostream::write(const char*t, int n)。 istream::read(signed char*t, int n)。 istream::read(unsigned char*t, int n)。 istream::read(char*t, int n)?!?。 return 0。 ofile這是一個(gè)沒有注釋的例子! 。 ofstream ofile(,ios::app)。包含標(biāo)準(zhǔn) C+
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1