zoukankan      html  css  js  c++  java
  • why there is any need for cout.put()?

    why there is any need for cout.put()?

    much of  the answer is historical.Before release 2.0 of c++ .cout would display character variables as characrers but display character constans.such as 'M' and 'N' as numbers.the problem was that earlier versions of c++,like C stored character constans as int .That is , the 

    the code 77 for 'M' would be stored in a 16-bit or 32-bit unit .meanwhile char variables typically occupied 8 bits a statement like the following copied 8 bits (the important 8 ) from the constant 'M' to the varable ch .

    char ch = 'M'

    unfortunates this mean that.to cout 'M' and ch looked quite different from one another.even though both held the same value.so a statement like the following wolud print the $ character rather than the simple display $

    cout<<'$'

    but the following would print the character as designed cout.put('$');

    now after release 2.0 c++ stores single character constants as type char not type int therefore cout now correctly handles characters constants.

    summary:

    with the english c++ book we can know many what we want to know , and that is very useful knowledge.study c++ and computer with english is coor.

  • 相关阅读:
    USACO 2017 US Open Contest Gold T1: Bovine Genomics
    自己瞎调的一些曲子
    NOIP前要干的一些事
    【[BJOI2018]链上二次求和】
    【MdOI2020】Path
    【[SDOI2018]旧试题】
    [IOI2018]werewolf狼人
    洛谷p5444 [APIO2019]奇怪装置
    洛谷p4211 [LNOI2014] LCA
    洛谷P2805 [NOI2009] 植物大战僵尸
  • 原文地址:https://www.cnblogs.com/accipiter/p/2983991.html
Copyright © 2011-2022 走看看