Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Ansi -iso > Re: adding char...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 198 of 215
Post > Topic >>

Re: adding characters

by scott moore <nospam@[EMAIL PROTECTED] > Dec 19, 2007 at 08:18 AM

Roman Töngi wrote:
> I have no pascal environment and do not want
> to install one just for this question.
> 
> Is this a valid expressen:
> 
> 'A' + 'A'
> 
> yielding 130 if ord('A') = 65
> 
> thx

ord('A') + ord('A')

or

chr(ord('A') + ord('A'))

If you want the result to also be a character.

Pascal is a typed language. 'A'+'A' is asking the
compiler to add two characters which is not possible,
since it has no meaning. In reality, you are asking
to add the character codes together, and you are asking
the compiler to automatically convert the characters to
their integer equivalents.

Pascal does not have a problem with that, it just wants
you to explicitly state what you are doing.
 




 3 Posts in Topic:
adding characters
=?ISO-8859-1?Q?Roman_T=F6  2007-12-19 16:28:19 
Re: adding characters
scott moore <nospam@[E  2007-12-19 08:18:14 
Re: adding characters
CBFalconer <cbfalconer  2007-12-19 22:37:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 18:17:29 CDT 2008.