Author |
Message |
mercuryy
|
Posted: Sat Mar 12, 2005 5:21 pm Post subject: abc |
|
|
How can you output something like
code: |
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 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Sat Mar 12, 2005 7:54 pm Post subject: (No subject) |
|
|
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
|
Posted: Sat Mar 12, 2005 8:04 pm Post subject: (No subject) |
|
|
what i got is
code: | 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. [/code] |
|
|
|
|
|
ssr
|
Posted: Sat Mar 12, 2005 8:30 pm Post subject: (No subject) |
|
|
I thnk what my teacher did on this quesion is do one loop for teh "*" and one loop for letters... 8) |
|
|
|
|
|
mercuryy
|
Posted: Sat Mar 12, 2005 8:39 pm Post subject: (No subject) |
|
|
yeah. but i tried that too.
code: | 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
|
Posted: Sat Mar 12, 2005 8:40 pm Post subject: (No subject) |
|
|
yah we had to do this one too, heres a hint to how i solved it
code: |
var letters :string :="ABCDEFG"
var counter:int
|
then
code: |
counter +=1
letters(counter)
|
also look up length in the help file, hope this helps |
|
|
|
|
|
ssr
|
Posted: Sat Mar 12, 2005 8:49 pm Post subject: (No subject) |
|
|
mercuryy wrote: yeah. but i tried that too.
code: | 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
|
Posted: Mon Mar 14, 2005 9:02 pm Post subject: (No subject) |
|
|
so there are no other ways beside using the "length" function? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Token
|
Posted: Mon Mar 14, 2005 10:03 pm Post subject: (No subject) |
|
|
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
but really you need to look at the help file to understand that |
|
|
|
|
|
ssr
|
Posted: Mon Mar 14, 2005 10:19 pm Post subject: (No subject) |
|
|
lol ord and chr arent that hard
code: | 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 |
|
|
|
|
|
Token
|
Posted: Mon Mar 14, 2005 10:22 pm Post subject: (No subject) |
|
|
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 but u took care of that for me didnt ya |
|
|
|
|
|
ssr
|
Posted: Mon Mar 14, 2005 10:26 pm Post subject: (No subject) |
|
|
lol, I knew I should spread my name all around the internet... |
|
|
|
|
|
Flikerator
|
Posted: Tue Mar 15, 2005 1:56 pm Post subject: (No subject) |
|
|
code: | 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
|
Posted: Tue Mar 15, 2005 2:24 pm Post subject: (No subject) |
|
|
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
code: |
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
|
Posted: Tue Mar 15, 2005 3:03 pm Post subject: (No subject) |
|
|
Token wrote: 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
code: |
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 |
|
|
|
|
|
|