How do I convert a long to a string in C++?

后端 未结 12 1260
慢半拍i
慢半拍i 2020-12-09 07:12

How do I convert a long to a string in C++?

12条回答
  •  执笔经年
    2020-12-09 07:52

    One of the things not covered by anybody so far, to help you think about the problem further, is what format should a long take when it is cast to a string.

    Just have a look at a spreedsheet program (like Calc/Excel). Do you want it rounded to the nearest million, with brackets if it's negative, always to show the sign.... Is the number realy a representation of something else, should you show it in Oractal or Hex instead?

    The answers so far have given you some default output, but perhaps not the right ones.

提交回复
热议问题