Main Menu

Aligning text

Started by geecee, March 07, 2009, 06:20:46 PM

Previous topic - Next topic

geecee

I have a problem aligning text in a programme I am writing.

In this example the first part works 100% all the time but my problem arises in the second part.


start:

cls rgb(0,0,0)
randomize timer()

print "This always right-aligns the text"

print ""

for a=1 to 40
  if a<=9
   t$=t$+" "
  endif
  t$=t$+str$(a)+" "

  if Mod(A,10)=0 then print t$: t$=""
next a

print "":print ""

print "This does not ..... why?"

print ""

start_number=rnd(44)+1:print "Start number "+str$(start_number)

print "":print ""

for a=start_number to start_number+15
  c=c+1
  if c<=9
    t$=t$+" "
  endif
  t$=t$+str$(a)+" "
  if mod(c,4)=0 then print t$: t$=""
next a

print "":print ""

print "press any key to rerun"

sync
waitnokey
waitkey

gosub start



Any suggestions?

???
Thanks
geecee
LANG MEY YER LUM REEK

A smile costs less than electricity and gives more light :)

kevin


Your logic is out of wack.


t$=""
for a=start_number to start_number+15
c=(a-Start_number)+1
   t$=t$+Right$("  "+str$(a),3)
   if mod(c,4)=0 then print t$: t$=""
next


geecee

Thanks for your reply kevin.

As always very helpful ...... Much appreciated

geecee
LANG MEY YER LUM REEK

A smile costs less than electricity and gives more light :)