Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie Needs Help! Problems!
#11
Quote:Okay, there are several ways you can optimize this.

Place the names of the months into some DATA statements, like so(though you could put them into a file):

Code:
DATA "January","February","March","April","May"
DATA "June","July","August","September","October","November"
DATA "December"

Then you read them into your array:

Code:
DIM Months(12) as STRING

FOR I = 1 TO 12
READ Months(I)
NEXT

Then, to print them out, do this:

Code:
FOR I = 1 TO 12
PRINT Months(I);" "
NEXT

Just put the code toghether, and it should work. You should see all 12 months printed out, even though it might wrap to the next line. If it does that, consider using abbreviations.

EDIT: Instead of putting DIM Month$(12), you can use DIM Months as STRING, so you don't have to use the dollar signs at the end of the variable name.

Your month late, optimized solution will print the months on SEPARATE LINES, which is not what the original intent was.

Kindly stop reviving old threads that have been concluded and have acceptable solutions.
*****
Reply
#12
Simplist way, is to have Month(1)="January " etc.
img]http://mike.thebrainroom.net/Avatars/Clyde.png[/img]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)