basic BASIC

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

Locked
buddpaul
Coder
Posts: 22
Joined: Thu Nov 23, 2006 5:21 pm
Location: Texas(US)

basic BASIC

Post by buddpaul »

OK........so, with the help of a tutorial, I learned the VERY ELEMENTARY command to creat a circle:

CLS
SCREEN 7 ' or could be SCREEN 13
CIRCLE (150, 100), 50, 2
END

Great.....big blue circle right in the middle of the screen.....I played with the parameters for 20 minutes entertaining myself....yippee.

But, I want to write a program that causes the computer to pick a random location on the screen to draw the circle. I know I'll have to establish MinX and MinY in addition to MaxX and MaxY.........but try as I might, I can't get the syntax figured out......could I get a nudge, please??
SCC
Coder
Posts: 12
Joined: Mon Oct 09, 2006 9:53 pm

Post by SCC »

I just threw this together in a few mintues, don't know if it's what you wanted or not...I don't have much experience yet, but this seemed simple enough...plus it's about all i know how to do at the moment, lol.

Code: Select all

CLS 
SCREEN 7
RANDOMIZE TIMER

FOR X = 1 TO 3
R1 = INT(RND * 150)
R2 = INT(RND * 100)
R3 = INT(RND * 50)

CIRCLE (R1, R2), R3, 2
NEXT X
END 
If you don't want multiple circles, just get rid of the FOR..NEXT

...oh, and about that MinX stuff, lol i have no idea where that would go.
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

http://www.petesqbsite.com/forum/viewtopic.php?t=1914

Limit yourself to a single topic about the same damned thing will you.

This topic is locked. Also, the answer has already been given in the other topic.
I have left this dump.
Locked