在C ++ Win32控制台应用程序中输出unicode符号π和≈ [英] Output unicode symbol π and ≈ in c++ win32 console application

查看:171
本文介绍了在C ++ Win32控制台应用程序中输出unicode符号π和≈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始编程,但是π(pi)符号似乎不在ASCII处理的标准输出集中.

I am fairly new to programming, but it seems like the π(pi) symbol is not in the standard set of outputs that ASCII handles.

我想知道是否有一种方法可以使控制台输出π符号,以便表达有关某些数学公式的准确答案.

I am wondering if there is a way to get the console to output the π symbol, so as to express exact answers regarding certain mathematical formulas.

推荐答案

我不太确定是否有其他方法(例如使用STL的方法),但是可以使用

I'm not really sure about any other methods (such as those that use the STL) but you can do this with Win32 using WriteConsoleW:

HANDLE hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
LPCWSTR lpPiString = L"\u03C0";

DWORD dwNumberOfCharsWritten;
WriteConsoleW(hConsoleOutput, lpPiString, 1, &dwNumberOfCharsWritten, NULL);

这篇关于在C ++ Win32控制台应用程序中输出unicode符号π和≈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆