下载此文档

定义容器容器.docx


文档分类:汽车/机械/制造 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
Container容器
方法:。include奇器>;#include<queue>。定莪容器:容器<元素!0型>容器物件名K;queue<char>pq0;priority_queue<int>pq1;//fi!先罹高者在前。「!之物件。namespace^EtSE中之物I!也是全域的!言己憧醴配置於静熊空冏,^持至程式结束。内定初使化舄0(所有成员属性都初始化舄0)Reference
方法:。资料型熊物件名稠;
资料型熊&物件别名=物件名K;必幻定之彳爰就不能更改!
。通常reference用於函数之形式参数(formalparameter)。相富於傅址呼叫高效率(不用拷参数於stack上)乂可保持直瓷的使用方式(不用使用指榇逼算)I/O
方法:。Input>>cin>>aChar;sfIn>>aChar;(aChar);(aChar);典>>最大的不同虚:
可Uwhitespace。Output<<cout<<aChar;sfOut<<aChar;(aChar);(aChar);StringOutput:<<Stringinput>>:extractionoperatorskipanyleadingwhitespaceextractallcontiguousnon-whitespacecharacterstheterminatingwhitespacecharacterisstillleftintheinputstream.
getline(fsIn〃禧案翰入,stringBuf〃存入建数,terminatingChar〃停止字元,内定舄’\n')getallcharactersuntilmeetingaterminatingcharactertheterminatingcharacterisdeletedStringInput:importantnotes
Theextractionoperatorstopsatwhitespace.
Toreadastringwithspaces,wemustusegetline.
getline(...)isastand-alonefunction.
ThestringI/Ooperatorsandfunctionsaredefinedin<string>headerfile,notthe<iostream>headerfile.
BlockInput
方法:。istream&read(char*buffer,intsize);intinArea[3];ifstreamfsIn(稽名",ios::binary|ios::in);((char*)inArea,3*sizeof(int));intnumRead=();//how
manybytesreadBlockOutput
方法:。ostream&write(constchar*buffer,intsize);intoutArea[3];...
ofstreamfsOut(稽名”,ios::binary|ios::out|ios::app);(

定义容器容器 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人likuilian1
  • 文件大小16 KB
  • 时间2022-04-05
最近更新