C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to write Chars like "²" ?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Max Bauer
Guest





PostPosted: Sat Feb 26, 2005 2:19 pm    Post subject: How to write Chars like "²" ? Reply with 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 Sad
Back to top
Martijn Mulder
Guest





PostPosted: Sat Feb 26, 2005 2:40 pm    Post subject: Re: How to write Chars like "²" ? Reply with quote



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 Sad


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





PostPosted: Sat Feb 26, 2005 2:55 pm    Post subject: Re: How to write Chars like "²" ? Reply with quote



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





PostPosted: Sat Feb 26, 2005 4:53 pm    Post subject: Re: How to write Chars like "²" ? Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.