C++的cout详解

2023年5月20日,周六早上:

我发现我找不到非常详细的cout类的成员函数,只好自己写了。

不定期更新。


cout的继承关系

cout类继承自ostream类,ostream类继承自ios类,ios类继承自ios_base类


cout类拥有的所有成员函数

1. 从 ios_base 类继承的公共成员函数:

  •  flags()
  •  flags(std::ios_base::fmtflags)
  •  width()
  •  width(int)
  •  precision()
  •  precision(int)
  •  fill()
  •  fill(char)
  •  exceptions()
  •  exceptions(std::ios_base::iostate)
  •  tie()
  •  tie(std::ostream*)
  •  rdbuf()
  •  rdbuf(std::streambuf*)
  •  imbue()
  •  imbue(const std::locale&)

2. 从 ios 类继承的公共成员函数:

  •  xalloc()
  •  pword(int)
  •  iword(int)
  •  register_callback(std::ios::event_callback, int) const
  •  copyfmt(ostream&)

3. 从 ostream 类继承的公共成员函数:

  •  operator<<()
  •  put(char)
  •  write(const char*, std::streamsize)
  •  flush()
  •  tellp()
  •  seekp()
  •  seekp(std::streampos)
  •  seekp(std::streamoff, std::ios_base::seekdir)

4. 自身定义的公共成员函数:

  •  good()
  •  eof()
  •  fail()
  •  bad()
  •  clear()
  •  rdstate()
  •  setstate(std::ios_base::iostate)
  •  unsetf(std::ios_base::fmtflags)
  •  precision()
  •  precision(int)
  •  width()
  •  width(int)
  •  fill()
  •  fill(char)
  •  tie()
  •  tie(std::ostream*)
  •  put(char)
  •  write(const char*, std::streamsize)
  •  flush()
  •  copyfmt(ostream&)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

巨龙之路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值