Getting the ASCII value , How?
Author |
Message |
freQ
|
Posted: Sat Nov 21, 2009 3:17 pm Post subject: Getting the ASCII value , How? |
|
|
What is it you are trying to achieve?
I am trying to make a simple encrypter, it will get the ascii value of a letter, then it will add, subtract and so on and then it will output it
What is the problem you are having?
I dont know how to get an ascii value of a letter
Describe what you have tried to solve this problem
i suppose you need to used the :read funtion
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
i was hoping somebody could post an example something like
open test.txt
get the values
add 1 to all the values
output output.txt
Please specify what version of Turing you are using
4.1.1 if you could suggest a better version please do so
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
DtY
|
Posted: Sat Nov 21, 2009 3:34 pm Post subject: Re: Getting the ASCII value , How? |
|
|
The ord() function is what you're looking for, and for the next logical question (how to get the character of a certain ascii value), you use chr()
|
|
|
|
|
|
freQ
|
Posted: Sat Nov 21, 2009 3:49 pm Post subject: RE:Getting the ASCII value , How? |
|
|
i am sorry but i am very lost with your explanation could you give me a simple example how to use those two functions?
|
|
|
|
|
|
Zren
|
Posted: Sat Nov 21, 2009 5:53 pm Post subject: RE:Getting the ASCII value , How? |
|
|
chr() and ord() functions have nothing to do with open, close, read or any other File Input/Output function.
Ord() is a function that will take a character (think of it as a string with only 1 letter/number/etc) and then return it's ASCII number value.
Turing: |
put ord("a") %output is 97
|
So you need to figure out how to break that file down into individual characters.
|
|
|
|
|
|
evildaddy911
|
Posted: Thu Nov 24, 2011 11:13 am Post subject: Re: Getting the ASCII value , How? |
|
|
a good thing to do is google your problem, then post if needed...
anyways, im trying to do a similar thing, i can encrypt the word, but then when I try to decrypt ,I only get numbers instead of words...
Description: |
|
Download |
Filename: |
encryption.t |
Filesize: |
983 Bytes |
Downloaded: |
197 Time(s) |
|
|
|
|
|
|
Dreadnought
|
Posted: Thu Nov 24, 2011 1:48 pm Post subject: Re: Getting the ASCII value , How? |
|
|
I'll give you a hint as to what your doing wrong. Check what the value of 'keynum' is when you encrypt and when you decrypt.
Hopefully that helps.
|
|
|
|
|
|
Aange10
|
Posted: Thu Nov 24, 2011 3:08 pm Post subject: RE:Getting the ASCII value , How? |
|
|
Just looking straight at the code, evil, your problem is apparent.
Another hint I'd like to give you, not only for solving problems, but before you ask anybody to help you, is to comment your code.
If you go through and tell us what your code is doing, you'll figure out what is wrong.
EDIT: Also using
will create wierd errors if a person types in anything with a space. Instead you should use
Turing: |
get key: *
% OR
get text: 255
|
|
|
|
|
|
|
|
|