Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 ASCII
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
The_$hit




PostPosted: Wed May 11, 2005 7:31 pm   Post subject: ASCII

how do you change a lettre into its ASCII value in C++?
Sponsor
Sponsor
Sponsor
sponsor
1of42




PostPosted: Wed May 11, 2005 8:51 pm   Post subject: (No subject)

I believe you can just cast it into an int, and vice versa.
wtd




PostPosted: Wed May 11, 2005 8:53 pm   Post subject: (No subject)

code:
char ch('t');
int i(static_cast<int>(ch));
The_$hit




PostPosted: Thu May 19, 2005 6:49 pm   Post subject: (No subject)

ok ty

i found you can do:

code:

char a="a";
int blah=int(a);
wtd




PostPosted: Thu May 19, 2005 7:07 pm   Post subject: (No subject)

The_$hit wrote:
ok ty

i found you can do:

code:

char a="a";
int blah=int(a);


Character constants must be surrounded by single-quotes, not double-quotes.

Take advantage of implicit conversion and the C++ initialization syntax.

c++:
char a('a');
int blah(a);
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: