### Maths Teacher

Hi,

I'm trying to develop an application to answer any maths questions. As a maths teacher the maths is easy for me.

But how do I print out a divide symbol to a console application? If possible I'd like to know how to use all ascii characters as well but the divide symbol is very significant.

I've tried google without success and even using unicode but it seems vastly complicated.

Is there a simple way to print out the ascii characters.

for example in Excel I use =CHAR(247) in java "\u00F7" as a string but how to achieve this in C++ seems to have beaten me, so please help.

Paul
Can you not just use '/' ?
Try:

Code:
 `` `` ``cout << char(0x2F);``

Output:
 `` `` ``/``

Where 0x2F is the ASCII hexadecimal representation for the forward slash (division symbol)

I'm guessing your using a keyboard without the / symbol? If not, why do you need this?
Last edited on
For pupils it would be vastly better to use the divide symbol that is ascii character 247 so could I use that?
You can use "\u00F7" in C++
Last edited on
Are you asking how to display this particular symbol or how to display anything in C++ ?

This symbol is in the ASCII table at index 246, so displaying it is not difficult: just use its value (246).
If you're not comfortable with using its value directly, you can use a proxy variable:
 ``1234`` ``````const char DivideSymbol = 246; // display the divide symbol std::cout << "The divide symbol is " << DivideSymbol << std::endl;``````
 ``123456789101112131415`` ``````cout << " / "; printf(" / "); puts (" / "); //if you want to see the ascii representation: int asci = '/'; cout << "The divide symbol is ascii character " << asci <
Last edited on
you can also do

 `` `` ``std::cout << char(246);``

Smac89, he doesn't want "/", he wants the "a dot above an underscore above a dot" division symbol
thanks a million, works a treat:

http://www.cplusplus.com/doc/ascii/ shows 2 sets of ascii characters, 246 is OEM Extended ASCII and 247 is OEM Extended ASCII Windows.

So thanks for toum as now I can print the divide symbol and for that matter any of the OEM Extended ASCII characters.

I need to use:

static const unsigned char DivideSymbol = 246; to stop compiler warnings but I'm using Visual Studio 2008 express so possibly that's why.

Thanks again!! :-)
Topic archived. No new replies allowed.