View unanswered posts | View active topics It is currently Mon Dec 22, 2014 11:11 pm






Reply to topic  [ 3 posts ] 
how to convert a text character to a figure or vice versa 
Author Message
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post how to convert a text character to a figure or vice versa
hi,
if you have a text letter like "a", "A", or "Z": how can you get the ASCII integer value of this?
e.g.
ASCII("a")=97,
ASCII("A")=65,
ASCII("Z")=90,
ASCII("1")=49,

and how can you encode an integer value to a text character?
chr(97)="a"
a.s.o.

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sat Sep 06, 2008 8:50 am
Profile
Rookie
User avatar

Joined: Thu Jun 26, 2008 11:27 am
Posts: 21
Location: Johannesburg, South Africa
Post Re: how to convert a text character to a figure or vice versa
Hi

This seems to work:
Code:
   string str = "A";
   int t = (int)str;
   nxtDisplayTextLine(1,"%d", t);
   
   char ch = 42;
   nxtDisplayTextLine(2,(string)ch);


Sat Sep 06, 2008 12:17 pm
Profile WWW
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: how to convert a text character to a figure or vice versa
thx a lot,
that's easier than I thought ... 8)

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Sat Sep 06, 2008 12:27 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.