| View previous topic :: View next topic |
| Author |
Message |
Max Bauer Guest
|
Posted: Sat Feb 26, 2005 2:19 pm Post subject: How to write Chars like "²" ? |
|
|
Hello!
How can i write Chars like "²" or "$" on the DOS Window when the
Programm is running?
I've tried f.e.
178
but this ignores the "8". And i dont know why
|
|
| Back to top |
|
 |
Martijn Mulder Guest
|
Posted: Sat Feb 26, 2005 2:40 pm Post subject: Re: How to write Chars like "²" ? |
|
|
Max Bauer wrote:
| Quote: | Hello!
How can i write Chars like "²" or "$" on the DOS Window
when the Programm is running?
I've tried f.e.
178
but this ignores the "8". And i dont know why
|
Try this program. On my system, it acts strange because the lower ascii
characters 'mean' something to the system. It may act strange, but it wont mess
up your system.
#include <iostream>
int main()
{
char a=0;
for(int b=0;b<16;b++)
{
for(int c=0;c<16;c++)
cout<
cout<
}
cout<<"nPrint a single character like this: "<<'x178';
return 0;
}
|
|
| Back to top |
|
 |
Max Bauer Guest
|
Posted: Sat Feb 26, 2005 2:55 pm Post subject: Re: How to write Chars like "²" ? |
|
|
Martijn Mulder wrote:
| Quote: |
#include
int main()
{
char a=0;
for(int b=0;b<16;b++)
{
for(int c=0;c<16;c++)
cout<
cout<
}
cout<<"nPrint a single character like this: "<<'x178';
return 0;
}
|
Thank you. You gave me what i needed!
Big Thanks!
|
|
| Back to top |
|
 |
David Lindauer Guest
|
Posted: Sat Feb 26, 2005 4:53 pm Post subject: Re: How to write Chars like "²" ? |
|
|
Max Bauer wrote:
| Quote: | Martijn Mulder wrote:
#include
int main()
{
char a=0;
for(int b=0;b<16;b++)
{
for(int c=0;c<16;c++)
cout<
cout<
}
cout<<"nPrint a single character like this: "<<'x178';
return 0;
}
Thank you. You gave me what i needed!
Big Thanks!
|
for your reference the root problem is if you do:
"178"
it treats it as octal, and 8 is not an octal digit. so you need to
either translate to octal ("262"),
or translate to hex ("xb2") or use a programmatic method like the above
of translating the decimal to a character.
David
|
|
| Back to top |
|
 |
|