codeblocks - C++ Infinity Sign -
codeblocks - C++ Infinity Sign -
hello wondering how can display infinity (∞) in c++? using codeblocks. read couple of q&a's on topic i'm newbie @ stuff, hex coding , stuff. have include , type out exactly. if can write code , explain it, that'd great! thanks!
the symbol not part of ascii code. however, in code page 437 (most of time default in windows command prompt english language locales/us regional settings) represented character #236. in principle
std::cout << static_cast<unsigned char>(236); should display it, result depends on current locale/encoding. on mac (os x) not displayed properly.
the best way go utilize unicode set of characters (which standardized big amount of characters/symbols). in case,
std::cout << "\u221e"; should job, unicode character #221 represents inf.
however, able display unicode, output device should back upwards utf encoding. on mac, terminal uses utf, windows command prompt still uses old ascii encoding codepage 437 (thanks @chris pointing out). according this answer, can alter unicode typing
chcp 65001 in command prompt.
c++ codeblocks
Comments
Post a Comment