Author |
Message |
junkpro11
|
Posted: Sun Apr 25, 2004 8:34 pm Post subject: making a hollow asterisks box |
|
|
im a noob at turing...im prob the worst in class cuz logic isnt my stong suit.and i took programming to learn sth different. can anyone help me how to make a hollow asterisk box with number of stars across input
eg. the input is 4
the box would be
****
* *
* *
* *
****
my code doesnt work....it onli makes this
****
**
**
****
code: |
var inum : int
put "enter number"
get inum
for row : 1 .. inum
for column : 1 .. inum
if column = 1 or column = inum or row = 1 or row = inum then
put "*" ..
end if
end for
put ""
end for
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
junkpro11
|
Posted: Sun Apr 25, 2004 8:36 pm Post subject: (No subject) |
|
|
what the? the boz is supposed to be outlined by asterisks but the inside is supposed to hollow
dunno y the msg appeared funni ![Embarassed Embarassed](http://compsci.ca/v3/images/smiles/icon_redface.gif) |
|
|
|
|
![](images/spacer.gif) |
Delos
![](http://www.members.shaw.ca/rfolz/delos_avatar.gif)
|
Posted: Mon Apr 26, 2004 9:49 am Post subject: (No subject) |
|
|
Hey, this is easy actually!
Just add an 'else' statement to your if condition.
It look funny on the board due to some odd space removal thing used... |
|
|
|
|
![](images/spacer.gif) |
Flashkicks
![](http://www.digital-sat.tv/copperfield67/Avatars/matrix.gif)
|
Posted: Mon Apr 26, 2004 10:34 am Post subject: (No subject) |
|
|
I remember having to do this when i was in grade nine! We also had to make a Christmas tree which most the kids had problems with..lol And its funny- i was one of them as well ![Laughing Laughing](images/smiles/icon_lol.gif) |
|
|
|
|
![](images/spacer.gif) |
Raugrist
![](http://www.voidspace.org.uk/gallery/silly/thumbnails/tn_big_cup_of_STFU.jpg)
|
Posted: Mon Apr 26, 2004 11:19 am Post subject: (No subject) |
|
|
Even easier like this:
code: |
var num : int
get num
put repeat ("*", num)
put "*", repeat (" ", num - 2), "*"
put "*", repeat (" ", num - 2), "*"
put "*", repeat (" ", num - 2), "*"
put repeat ("*", num)
|
Good ol' repeat function. |
|
|
|
|
![](images/spacer.gif) |
junkpro11
|
Posted: Mon Apr 26, 2004 8:49 pm Post subject: (No subject) |
|
|
thank you everyone! im in gr. 10 but teacher didnt teach us repeat yet...
this question is on the hw sheet...to prepare us for the test on wed. u can see im not tat good with programming....lacking logic so ty for helping me!!!!
|
|
|
|
|
![](images/spacer.gif) |
|