Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print Greek letter delta in c++

Tags:

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;

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.

Thanks in advance!

like image 570
Will Callender Avatar asked Oct 26 '16 21:10

Will Callender


People also ask

How do you write Greek Delta?

Delta (/ˈdɛltə/; uppercase Δ, lowercase δ or 𝛿; Greek: δέλτα, délta, [ˈðelta]) is the fourth letter of the Greek alphabet. In the system of Greek numerals it has a value of 4. It was derived from the Phoenician letter dalet 𐤃. Letters that come from delta include Latin D and Cyrillic Д.

How do you get Greek letters?

First, select the “Greek (abc -> Ελληνικά)” keyboard from the Gboard menu on your Android device. icon in order to select the “Greek (abc -> Ελληνικά)” keyboard. Once the model downloads, you'll be ready to start using the new keyboard! You can either tap or glide type.


1 Answers

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';
}

output: ΔV

Live Demo

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

and for Greek lower letters:

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

Live Demo

For people interested on other alphabets, as well as on other symbols, you could find more supported escape characters here.

like image 118
101010 Avatar answered Oct 02 '22 03:10

101010