Page 1 of 1

help for a beginner

Posted: Mon Nov 08, 2004 12:35 am
by merrick
Hi, I am having some trouble with a Qbasic code that's supposed to print a pyramid looking like 0
1 0 1
2 1 0 1 2
3 2 1 0 1 2 3
etc using a nested if statement. I'm very new at this and I would like any help possible. Thanks!

Posted: Mon Nov 08, 2004 5:11 am
by eevee
This seems to work! All integers and in no way optimised.

If you require a true pyramid shape you will have to space out to the print position - use max as the spacing control.

max = 8 'Set no. of lines
CLS
PRINT " 0" 'First line

FOR x = 1 TO max
y = x 'Going up
WHILE y <> 0
PRINT y;
y = y - 1
WEND
PRINT " 0 "; 'Middle zero
y = 1 'Going down
WHILE y <> x + 1
PRINT y;
y = y + 1
WEND
PRINT 'Release line
NEXT x

Regards,

Eevee

Posted: Mon Nov 08, 2004 5:42 am
by Z!re
Ok, homework begg.. err, i mean, new person wanting to learn QB...


1) Pay attention in class
2) Pay attention in class
3) See #2
4) http://forum.qbasicnews.com/viewtopic.p ... ht=pyramid

I hate homework beggers.. atleast try to make it so not obvious... gee


Fail class.

Posted: Mon Nov 08, 2004 1:21 pm
by Guest
Oh dear!

Did I get it wrong?

Shouldn't they have a badge or something??

Regards,

Eevee

Posted: Mon Nov 08, 2004 2:04 pm
by Z!re
:oops: i didnt even try your code Eevee

sorry, it probably works though...


I doubt merrick will be coming back anytime soon, or at all :P

Posted: Mon Nov 08, 2004 2:14 pm
by Guest
I wasn't referring to the code .but ...........

..... to an inability to spot homework beggars!

Regards,

Eevee

Posted: Mon Nov 08, 2004 3:08 pm
by Z!re
Oh...

Well we all miss one once in a while :wink:



Well, tell you what, I can join your party, and we can go gain some exp, until you gain an extra skill in "Homweork beggar spotting" :D
How does that sound?

Posted: Mon Nov 08, 2004 4:36 pm
by {Nathan}
Count me in. Also, tell me. WHERE THE HECK WOULD YOUR HOMEWORK INVOLVE USING QBASIC???!!!

Posted: Mon Nov 08, 2004 4:48 pm
by Z!re
In the great, educated, freedom fighting, world police, greatest democracy (err... republic, but nevermind) The US...


Flight to New York:
"This is your captain speaking. We are now traveling 100 years back in time, to an age when we still used pounds, and gallons, and miles... The metric system is yet to be discovered"