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

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -