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

Username:   Password: 
 RegisterRegister   
 How to make symmetrical text in turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ylcc23




PostPosted: Wed Dec 03, 2014 8:38 am   Post subject: How to make symmetrical text in turing

I was trying to make a double sided triangle pattern in turing earlier but I ended up giving up on it as I couldn't figure out how to make the other side of the triangle. I'm curious as to how to make it as I would like to finish it just so I can have the experience for later.

Turing:

var long, count : int
var b : int
var words : array 1 .. 26 of string
var words2 : array 1 .. 26 of string
var word1, rword : string
var temp, letters : string := ""

count := 1
put "Please enter some words. Please make your last word quit."
loop
    get words (count)
    exit when words (count) = "quit"
    count := count + 1
end loop
count := count - 1
cls
long := 0
for i : 1 .. count
    b := length (words (i))
    if b > long then
        long := b
    end if
end for
for i : 1 .. count
    word1 := words (i)
    if length (words (i)) < long then
        word1 := word1 + repeat (word1 (length (word1)), long - length (word1))
    end if
    words (i) := word1
end for
for i : 1 .. long
    for j : 1 .. count
        word1 := words (j)
        if i > length (word1) then
            put word1 : 25 ..
        else
            put word1 (1 .. i) : 25 ..
        end if
        words (j) := word1
    end for             %j
    put ""
end for             %i
for decreasing i : long - 1 .. 1
    for j : 1 .. count
        word1 := words (j)
        if i > length (word1) then
            put word1 : 25 ..
        else
            put word1 (1 .. i) : 25 ..
        end if
        words (j) := word1
    end for             %j
    put ""
end for             %i
for decreasing i : count .. 1
    for j : 1 .. long
        word1 := words (i)
        if length (words (i)) < long then
            word1 := word1 + repeat (word1 (length (word1)), long - length (word1))
        end if
        words (i) := word1
    end for     %j
    put ""
end for     %i
for i : long + 1 .. long - 1
    for j : 1 .. count
        word1 := words (i)
        rword := ""
        b := ((long * 2) - (abs (1)))
        for decreasing k : length (word1) .. 1
            rword := rword + words (k)
        end for     %k
        if abs (1) > length (word1) or (((length (word1 (abs (1)))))) < 1 then
            put word1 : 2 ..
        else
            put rword ((length (word1) - abs (j))), length (word1) ..
            put word1 (1 .. abs (1) + 1) : b ..
        end if
    end for     %j
    put ""
end for     %i
for i : 1 .. count
    for decreasing j : length (word1) .. 1
        temp := temp + letters
    end for
    words2 (i) := temp
end for
put temp

Thanks in advance if you can help me finish the pattern Smile
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: