
-----------------------------------
mercuryy
Sat Mar 12, 2005 5:21 pm

abc
-----------------------------------
How can you output something like

A A A A A A
* B B B B B
* * C C C C
* * * D D D 
* * * * *E E
* * * * * *G

using counted loop? 

* indicate space

-----------------------------------
Cervantes
Sat Mar 12, 2005 7:54 pm


-----------------------------------
What have you got so far?  What are your ideas?
These problems are best for you to do.  You don't learn if we give you the answer.  But we can help you.  So, on those lines, what are your ideas?

-----------------------------------
mercuryy
Sat Mar 12, 2005 8:04 pm


-----------------------------------
what i got is 

for decreasing row:26..1
for col:1..26-row

put chr(row+64):3..

end for
delay (56)
put " "
end for

but than i can't get it to "flip" to the other side.  :oops: [/code]

-----------------------------------
ssr
Sat Mar 12, 2005 8:30 pm


-----------------------------------
I thnk what my teacher did on this quesion is do one loop for teh "*" and one loop for letters... 8)

-----------------------------------
mercuryy
Sat Mar 12, 2005 8:39 pm


-----------------------------------
yeah. but i tried that too.

for  decreasing row:26..1
for  decreasing col:row..1
put chr(row+64):3..
end for
put " "
end for

here is another way i tried. but the ouput is still on the "wrong" side.

-----------------------------------
Token
Sat Mar 12, 2005 8:40 pm


-----------------------------------
yah we had to do this one too, heres a hint to how i solved it


var letters :string :="ABCDEFG"
var counter:int


then


counter +=1
letters(counter)

also look up length in the help file, hope this helps

-----------------------------------
ssr
Sat Mar 12, 2005 8:49 pm


-----------------------------------
yeah. but i tried that too.

for  decreasing row:26..1
for  decreasing col:row..1
put chr(row+64):3..
end for
put " "
end for

here is another way i tried. but the ouput is still on the "wrong" side.
my fault didnt explain it well
2 separate loops, I will post my code later on
eventually
...
yes
... 8)

-----------------------------------
mercuryy
Mon Mar 14, 2005 9:02 pm


-----------------------------------
so there are no other ways beside using the "length" function?

-----------------------------------
Token
Mon Mar 14, 2005 10:03 pm


-----------------------------------
i'm sure theres way more than that way, for example.  maybe look at the chr and ord functions and think about doing a for statement somthing like


for i:65..71

 
but really you need to look at the help file to understand that

-----------------------------------
ssr
Mon Mar 14, 2005 10:19 pm


-----------------------------------
lol ord and chr arent that hard
var chars:char
var ints: int
get chars
get :ints
ord (chars)
chr(ints)
it basically get a char and convert it into a ACSII number also it gets a ACSII number and convert it into a char.
*** 
I know u know how to do it token
just saying its not hard :D

-----------------------------------
Token
Mon Mar 14, 2005 10:22 pm


-----------------------------------
lol i know Sirui Song , i was just saying i didnt feel like explaining it t him so he'd have to look it up for himself  :lol:  but u took care of that for me didnt ya  :wink:

-----------------------------------
ssr
Mon Mar 14, 2005 10:26 pm


-----------------------------------
lol, I knew I should spread my name all around the internet... :D

-----------------------------------
Flikerator
Tue Mar 15, 2005 1:56 pm


-----------------------------------
var let : string := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i : 1 .. length (let)
    for ii : 1 .. length (let) + 1 - i
        put let (i) ..
    end for
    put ""
    delay (50)
end for

Is that what you want? I don't think it is but maybe use it to do what you want?

-----------------------------------
Token
Tue Mar 15, 2005 2:24 pm


-----------------------------------
Flickerator thats basically what i did, only the thing is u have to do it the oposite way, so that they form against an imaginary margin on the right side, this is how i did it


var letters : string := "ZYXWVUTSRQPONMLIJIHGFEDCBA"
for decreasing i : length (letters) .. 1
    for j : 1 .. length (letters) - i
        put " " ..
    end for
    for j : 1 .. i
        put letters (i) ..
        delay (10)
    end for
    put " "
    delay (10)
end for


and you can change it to say ne thing u want, but it has to be backwards

-----------------------------------
Flikerator
Tue Mar 15, 2005 3:03 pm


-----------------------------------
Flickerator thats basically what i did, only the thing is u have to do it the oposite way, so that they form against an imaginary margin on the right side, this is how i did it


var letters : string := "ZYXWVUTSRQPONMLIJIHGFEDCBA"
for decreasing i : length (letters) .. 1
    for j : 1 .. length (letters) - i
        put " " ..
    end for
    for j : 1 .. i
        put letters (i) ..
        delay (10)
    end for
    put " "
    delay (10)
end for


and you can change it to say ne thing u want, but it has to be backwards
Well you could take the original word and just make it backwords. That way you could ask the person for a word and they could still do it :P

-----------------------------------
Token
Tue Mar 15, 2005 3:17 pm


-----------------------------------
yah you could, or   you could even go one step further and get the input from the user and make that backwards. (i didnt feel like taking the variable and turning it around, it just takes up more space, but this isnt so bad... an extra 8 lines)

var letters : string := ""
var word : string % := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var counter : int

put "Enter the word: " .. %%this line
get word                  %%this one too

for decreasing i : length (word) .. 1
    letters += word (i)
end for
cls
delay (500)
for decreasing i : length (letters) .. 1

    for j : 1 .. length (letters) - i
        put " " ..

    end for
    for j : 1 .. i
        put letters (i) ..
        delay (10)
    end for
    put " "
    delay (10)
end for


to make it work without the get, uncomment the 2nd line and comment the marked lines (5,6)
