问题描述
我有一个基于控制台的小型应用程序,它将解决物理方程式.我试图问用户是否要在给定情况下找到ΔV,但我不知道如何将字母delta打印到控制台.这是我的代码:
I have a small console based application that will solve physics equations. I am trying to ask the user if they want to find the ΔV in a given situation, but I can't figure out how to print the letter delta to the console. Here's my code:
cout << "Select what you would like to find:\n"
<< "1 - Acceleration" << endl
<< "2 - Initial Velocity" << endl
<< "3 - Final Velocity" << endl
<< "4 - ΔV" << "\n\n";
cin >> choice;
这不会在控制台上打印ΔV".Δ"甚至没有显示在我的IDE(Dev-C ++)中,而是显示为问号.如果有人知道如何将Δ打印到控制台,我将非常感谢您能为我提供的任何帮助.
This does not print "ΔV" to the console. The "Δ" doesn't even display in my IDE (Dev-C++), instead being displayed as a question mark. If anyone knows how I can print Δ to the console I would highly appreciate any help you can give me.
提前谢谢!
推荐答案
如果平台支持,则可以使用Unicode转义字符.对于希腊首都三角洲,代码为 \ u0394
:
If your platform supports it, you could use unicode escape characters. For Greek capital delta the code is \u0394
:
#include <iostream>
int
main() {
std::cout << "\u0394V" << '\n';
}
输出:ΔV
对于将来的读者,下面我给出希腊大写字母的转义序列:
For the future reader, bellow I give the escape sequences for Greek capital letters:
Letter Description Escape-Sequence
-------------------------------------
A Alpha \u0391
B Beta \u0392
Γ Gamma \u0393
Δ Delta \u0394
Ε Epsilon \u0395
Ζ Zeta \u0396
Η Eta \u0397
Θ Theta \u0398
Ι Iota \u0399
Κ Kappa \u039A
Λ Lambda \u039B
Μ Mu \u039C
Ν Nu \u039D
Ξ Xi \u039E
Ο Omicron \u039F
Π Pi \u03A0
Ρ Rho \u03A1
Σ Sigma \u03A3
Τ Tau \u03A4
Υ Upsilon \u03A5
Φ Phi \u03A6
Χ Chi \u03A7
Ψ Psi \u03A8
Ω Omega \u03A9
以及希腊小写字母:
Letter Description Escape-Sequence
-------------------------------------
α Alpha \u03B1
β Beta \u03B2
γ Gamma \u03B3
δ Delta \u03B4
ε Epsilon \u03B5
ζ Zeta \u03B6
η Eta \u03B7
θ Theta \u03B8
ι Iota \u03B9
κ Kappa \u03BA
λ Lambda \u03BB
μ Mu \u03BC
ν Nu \u03BD
ξ Xi \u03BE
ο Omicron \u03BF
π Pi \u03C0
ρ Rho \u03C1
σ Sigma \u03C3
τ Tau \u03C4
υ Upsilon \u03C5
φ Phi \u03C6
χ Chi \u03C7
ψ Psi \u03C8
ω Omega \u03C9
对于对其他字母以及其他符号感兴趣的人,您可以找到更多受支持的转义字符 此处 .
For people interested on other alphabets, as well as on other symbols, you could find more supported escape characters here.
这篇关于如何在C ++中打印希腊字母delta的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!