2 Replies - 539 Views - Last Post: 28 August 2013 - 02:00 AM Rate Topic: -----

#1 Jaacobbi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-August 13

SmallBASIC task request - can't make this work

Posted 27 August 2013 - 02:05 AM

So I got a task, I have to make a program with SmallBASIC.

I'm not talking about Microsoft smallbasic, I'm talking about this one..

So, my task is:

a) Write a program which draws 10 x- direction lines and 10 y- direction lines (coordinates)

(hint line 20,20,200,200 draws a line in coordinates 20,20 -> 200,200)
make a for- loop


B)/> change the program that it asks the amount of lines and if user inserts less than 1 or more than 100 the program gives a error message




This is what I've got so far:


input "How many lines?", amount

if amount<1 OR amount>100
   print "Invalid amount. Insert amount between 1 and 100."
endif
 
  for a=1 to amount

     line 50, 50, 200, 200

  next

pause



So could someone make this work? I've used a week trying to figure this out.. normally it takes 15minutes maxium.. I'm out of ideas and tries..

Appreciate every effort put into this.

Is This A Good Question/Topic? 0
  • +

Replies To: SmallBASIC task request - can't make this work

#2 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1369
  • View blog
  • Posts: 4,741
  • Joined: 19-February 09

Re: SmallBASIC task request - can't make this work

Posted 27 August 2013 - 08:38 PM

Hi, does anything happen when you run it?

Should the keywords not be capitalized eg IF, FOR, NEXT, PAUSE etc.
Was This Post Helpful? 0
  • +
  • -

#3 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2133
  • View blog
  • Posts: 3,266
  • Joined: 21-June 11

Re: SmallBASIC task request - can't make this work

Posted 28 August 2013 - 02:00 AM

I'm assuming your program runs, but you only see one line no matter what number you enter. The reason for that is that you draw all your lines at the same coordinates, so the lines just keep drawing over each other. You should use your x variable in the coordinates, so that each line is drawn at different coordinates.

The assignment doesn't specify where you're supposed to draw the lines, how much space is supposed to be between them or how long they're supposed to be, so I assume that doesn't matter.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1