Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:15 26 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : 2D array not initialising with values

Author Message
Gbbickerton
Newbie

Joined: 22/06/2022
Location: United Kingdom
Posts: 11
Posted: 05:52pm 09 Feb 2024
Copy link to clipboard 
Print this post

This code prints out 2 columns of zeros, (it is the times and cadence for the British cycling 20 minute warm up) white space is added to align times with cadence when the screen width is set just right, the "DIM" is all on one line.
Why aren't the values being assigned to the array?


DIM integer BS20min (13,2) (300,120,120,120,90 ,30 ,120,6  ,60 ,6  ,60,6  ,165,                          
                           90, 95, 100,105,110,120,90, 150,90, 150,90,150,90)

for x = 0 to 12
for y = 0 to 1
print BS20min (x,y);
print " ";
next y
print   'new line
next x
 
Gbbickerton
Newbie

Joined: 22/06/2022
Location: United Kingdom
Posts: 11
Posted: 06:08pm 09 Feb 2024
Copy link to clipboard 
Print this post

Missing = sign sorted!
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 828
Posted: 10:11am 10 Feb 2024
Copy link to clipboard 
Print this post

Can you please post your working code?
Thank you very much!!!

Frank
 
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 08:12pm 10 Feb 2024
Copy link to clipboard 
Print this post

I made some changes to your code

option explicit
option base 0

dim BS20min%(12,1)=(300,120,120,120,90,30,120,6,60,6,60,6,165,  90,95,100,105,110,120,90,150,90,150,90,150,90)
dim x%, y%

for x% = 0 to 12
   for y% = 0 to 1
       print right$(space$(3) + str$(BS20min%(x%, y%)), 3) + " ";
   next y%
   print
next x%


output:


Edited 2024-02-11 06:15 by LeoNicolas
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024