
-----------------------------------
zero44
Tue Sep 15, 2009 1:24 pm

How to make a pogram output TeXt LiKe ThIs
-----------------------------------
Im trying to make a program that can get a String of text then check if it is capital or lowercase for each go then change all the characters so the text come out like AbCdEfGhIJkLmNo.

-----------------------------------
BigBear
Tue Sep 15, 2009 1:45 pm

RE:How to make a pogram output TeXt LiKe ThIs
-----------------------------------
In the F10 Help under Turing Language 

Keystroke code 

how can u tell if a letter is lower case or upper case base on its ordinal value

-----------------------------------
zero44
Tue Sep 15, 2009 2:32 pm

Re: How to make a pogram output TeXt LiKe ThIs
-----------------------------------
thx for the help but what i need to knw is what i can do to check if a number is odd or even would help i tried this but it doesn't help

[code]% checks if number is odd
var num : int
get num
if num/2 = int then 
put "youre number is even"
else 
put "youre number is odd"[/code]

-----------------------------------
Insectoid
Tue Sep 15, 2009 2:50 pm

RE:How to make a pogram output TeXt LiKe ThIs
-----------------------------------
Every letter has a numerical value: It's ordinal value. This is it's ASCII code. Capital letters have different values than lower case letters. Iterate over each letter (with a for loop I would suggest) and use the ord() command to determine the value of the letter. From there you can figure it out yourself.

-----------------------------------
BigBear
Tue Sep 15, 2009 2:52 pm

Re: How to make a pogram output TeXt LiKe ThIs
-----------------------------------
The thing I wanted you to realize was check if it is less than or greater than 96

but to check if it is odd or even

[code]% checks if number is odd
var num : int
get num
if num/2 = int then
put "youre number is even"
else
put "youre number is odd"[/code]

First of all there is a few things

[code]if num/2 = int then[/code]

num is an integer because when you declared it you put 
[code]
var num : int[/code]

Integer means it can only be whole numbers real numbers can be decimal numbers and whole numbers

for integers instead of using / for divided by you use div

so 

[code]if num div 2 = int then[/code]

But you cannot say = int because int is a type

You could use 


[code]if num div 2 = 0 then[/code]

-----------------------------------
zero44
Tue Sep 15, 2009 2:59 pm

Re: How to make a pogram output TeXt LiKe ThIs
-----------------------------------
every one thx for your help but these method seems to work perfectly

[code]var num : int
var x : int
get num

x = num mod 2
if x = 1 then
put "odd"
else
put "even"
end if[/code]

-----------------------------------
Insectoid
Tue Sep 15, 2009 3:03 pm

RE:How to make a pogram output TeXt LiKe ThIs
-----------------------------------
So...did we answer your first question right or did you just switch questions? Re-reading the thread it looks like this:

You: Hey I need help with this...
Us: Have a look at this...
You: Thanks, but all along I actually needed help with this other thing.

-----------------------------------
zero44
Tue Sep 15, 2009 3:07 pm

Re: How to make a pogram output TeXt LiKe ThIs
-----------------------------------
ahh no i just forget to mention that i already know how to convert a capital to lowercase by adding 32 in ord but i need to figure out how to tell the computer which one to change and which one not to, so i was gonna do it by odds and evens so all the odd counts in string become caps and all the even become lowercase .... i hope i make sense.....having that said if anyone could help change the script so it comes out as boleen so if even true and if odd false?

-----------------------------------
BigBear
Tue Sep 15, 2009 3:12 pm

RE:How to make a pogram output TeXt LiKe ThIs
-----------------------------------
you are already checking if even or odd so just after you put "even"

have a variable be assigned to true?

-----------------------------------
zero44
Tue Sep 15, 2009 3:28 pm

Re: How to make a pogram output TeXt LiKe ThIs
-----------------------------------
ok this is what i have so far but it doesn't work need to fix 2 things the boleen and how to read what postion in loop the procces is at

[code]var upperCaseString := "a"
var lowerCaseString := ""
get upperCaseString
var num : int
var t : int
var x : int


procedure check
    x := num mod 2
    if x = 1 then
        var t := 1
    else
        var t := 0
    end if



    for i : 1 .. length (upperCaseString)
        upperCaseString (i) := num
        check
        if t := 1 then
            if ord (upperCaseString (i)) >= 65 and ord (upperCaseString (i)) = 97 and ord (upperCaseString (i)) = 65 and ord (upperCaseString (i)) = 97 and ord (upperCaseString (i)) = 65 and ord (upperCaseString (i)) = 97 and ord (upperCaseString (i)) = 65 and ord (upperCaseString (i)) = 97 and ord (upperCaseString (i)) = 65 and ord (upperCaseString (a)) = 97 and ord (upperCaseString (a)) = 65 and ord (upperCaseString (a)) = 97 and ord (upperCaseString (a)) 