Help me please????? Need answers to questions... will pay

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
smudge
Newbie
Posts: 9
Joined: Sun Jun 08, 2008 9:28 pm

Help me please????? Need answers to questions... will pay

Post by smudge »

Hello all... i am taking a test for a job Saturday June 14th, and for some reason they want me to know some simple qbasic. (its not relevant for what i do)...
CAN ANYONE HELP ME WITH SOME QUESTIONS? Some sample questions are below. I need answers to about 20 questions explained.... i would send a $20 money order to anyone who can help... not much, but hey im out of work. My email address is ROOOCAT@AOL.COM

sample questions.....
1) The statements: 100 VIEW (0,0) ? (100,100)
110 WINDOW (100,100) ? (150,150) would associate the ph7yscial coordinates (100,100) with the world coordinates (150,100) - WHY??????

2) A viewport has been created whose corners are at 920,10), (16,10) (60,50) and (20,50). The statement that assigns the world coordinates (1,0) to the lower left corner and (10,100) to the upper right corners is ? WINDOW (1,0) ? (10,100)

Questions for this statement:

100 SCREEN 1,0 : CLS : KEY OFF : COLOR 1,0
120 DIM ARRATY .OF. PIXELS (114)
130 LINE (0,0) ? (40,40), 3, BF
140 GET (1,)) ? (40,40), ARRAY .OF. PIXELS

3) The instruction in line 130 will draw a A FILLED RECTANGLE 41 PIXELS WIDE AND 11 PIXELS HIGH ? WHY?????

4) The instruction in line 140 WILL STORE THE PIXELS OF THE RECTANGLE IN AN ARRAY ? WHY???

5) If rthe following lines were added: (TO ABOVE STATEMENT):

150 PUT (0,0), ARRAY OF PIXELS
160 PUT (10,10) ARRAY OF PIXELS

The program would MOVE THE SAME RECTANGLE DOWN AND TO THE RIGHT ? WHY??????
User avatar
Codemss
Veteran
Posts: 124
Joined: Sun Jun 24, 2007 6:49 am
Location: Utrecht, The Netherlands
Contact:

Post by Codemss »

Mmm. there are some weird things you say there.
LINE (0,0) ? (40,40), 3, BF
Should make a box. It's filled because of the BF at the end. B will show the edges(B = Box, BF = Box, Filled). No BF or B will show the line. Notice that in some screen modes, (I remember 9 and 13 but I'm not quite sure), squares(that is a box of 40x40) don't look like they are equal height and width. That is because of the weird pixel divison. Normally xsize/ysize should be 5/6. In screen 13; 320/200 it's 8/5.
In screen 13, you can multiply the y by 5/6 (out of my head), then it should look good:
LINE (0,0)-(40,40*5/6), 3, BF
(In screen 9, you have to multiply it with another value, you can search the resolution woth the qb help, try it, or either try to figure it out, it most likely a number diveded by another, like 5/6 in screen 13)

Some other things:
GET (0,0)-(x%,y%), array%(index%)
stores the pic from 0,0 to x%,y% in the array array% on number index%.
You need to dim the array before that
Dim array(size%) as integer
(these are all with integer signs cuz there are faster but you simply:
DEFINT A-Z too)
Ow, and the size of the array is: xsize * ysize / 2
Mind that with GET (0,0)-(40,40) the x and y size is 41, cuz 0 is counted too.

Then you can PUT the picture:
PUT (x%,y%), array%(index%), PSET
That PSET means: erase everything under it. If you dont use it, it will be the same as there's standing XOR. That means: XOR each pixel with the pixel on the array. If there's a black background, you can XOR too, and XOR again to make the pix dissapear(XOR magix :P)

150 PUT (0,0), ARRAY OF PIXELS
160 PUT (10,10) ARRAY OF PIXELS
line 150 erases the picture on 0,0
and line 160 paints a new one at 10,10
It looks like its going down and to the right

Hope you understand, post any more questions I'll be glad to help(I'm free :P)
Check out my site: <a href="http://members.lycos.nl/rubynl">Click here</a>
Hope you like it. Send some feedback if you want: <a href="mailto:basicallybest@live.nl">Mail me</a>
Codemss, before known as RubyNL
smudge
Newbie
Posts: 9
Joined: Sun Jun 08, 2008 9:28 pm

Post by smudge »

thanks so much.... ive got more questions! will email you at your site... THANKS THANKS THANKS!
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

I LOVE CHEATERS!

Post by burger2227 »

Why would anybody ask you those questions if they do not pertain to the job?

I would say that you must be a cheater! Especially if you are willing to pay. Sure you are gonna send a check.......LOL

But Codemms has been taking other people's code for years and saying it is his, so you belong together.........
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
Mentat
Veteran
Posts: 409
Joined: Tue Aug 07, 2007 3:39 pm
Location: NC, US

Post by Mentat »

Play nice.

We help for free, in the spirit of The Spirit.
Seriously, we're a bunch of geeks, some of us with too much time on our hands (I wish I could say that of myself).

#3 : Remember that starting on a pixel includes that pixel in the dimensions. So, a line from (0,0) to (5,0) is six pixels long, because you're including 0. pixel 0 is length 1, pixel 1 is length 2 down, etc.

#4 : GET stores an image into an array. That's what GET does.

#5 : PUT displays the stored image.
For any grievances posted above, I blame whoever is in charge . . .
smudge
Newbie
Posts: 9
Joined: Sun Jun 08, 2008 9:28 pm

Post by smudge »

thanks so much for the helpful responses. - liz
Post Reply