Originally Posted by
jackson6612
I'm extremely sorry, stahta01. I couldn't understand your reply because of my own limitations.
ASCII are codes for various symbols. "ANSI escape sequences" can be used (eg) to control terminal colors, as shown above, on ANSI compliant devices (which your text console emulates).
Unfortunately, pi is not part of the basic ASCII set, which is limited to 255 one byte values. Fortunately, the C++ standard allows the use of unicode characters, qv:
List of Unicode characters - Wikipedia, the free encyclopedia
We want the Greek small letter pi. So:
Code:
#include <iostream>
#define BOLDMAGENTA "\033[1;35m"
#define PI_SYMBOL "\u03c0"
using namespace std;
int main(void) {
cout << "Symbol for pi: " << BOLDMAGENTA << PI_SYMBOL << endl;
return 0;
}
Should yield π.