I just got back from camp and started working on it again and I came up with
function prime(n)
prime=1
for x=2 to sqr(n)
if (x mod n)=0 then prime=0
next x
It puts out 1 if it's prime and 0 if it isn't.
Yeah I've tried that too...It works good until I get into the ten-thousands then it starts to take about a minute to calculate and I just don't have that kind of time to sit at my computer for hours on end just to find out if a really big number is prime...I know there is some good formula out...
I was wondering if anyone knew how to check if a number was prime or not...I already know about using logarthmic integrals and x/ln x but I need something that will give me a good answer every time
Also you could just pset((r*cos(d))+x,(r*sin(d))+y) where r is the radius of the cirle, x and y are the x and y coordinates on the screen, and d is the degree to rotate the point around (x,y)
You could make your own line sub that draws the line from point a to point b and before you draw each pixel you could test to see what color the pixel is and if it is not a certain color than you exit the sub
make two random coordinates and then before you draw the line between the two coordinates use the POINT command to check the color of the pixel at those two points and if the pixel color is not equal to 0 then choose two new random coordinates
Or you could decrease the interval you move at, instead of your code you could use
screen 13
do
randomize timer
x = int(rnd * 320)
y = int(rnd * 200)
pset (x,y)
a = int(rnd * 4)
if a = 1 then x = x + .1
if a = 2 then x = x - .1
if a = 3 then y = y + .1
if a = 4 then y = y - .1
cls
loop
open the file and have a do until loop that stops once you get to the end of the file, and in the middle of the loop check each data line to see if it has characters or not
double buffering in qbasic is basically creating an array and using the array as a memory block with which you can PEEK and POKE data to and then flip it onto the screen. In screen 13 it would be something like this:
Screen 13
'set up my first page
dim page1%(32000)
'set up my second page
dim...
I'm using turbo c++ 1.1 and when I try to compile things it says i'm missing tclasss.lib. It used to work but something happened and I dont know what. can someone help me?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.