Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array help

Status
Not open for further replies.

bjarvis

Technical User
Jan 15, 2001
38
0
0
US
I have an assingment for my qbasic class. I have to have a two dimensional array. I have to have six columns and five rows. The rows are different departments and The columms are filled with each days sales for the departments. The problem I'm having is in the fifth row and sixth column I have to have the totals. I don't know how to do this with arrays. Any help would be greatly appreciated.
 
Well, I didn't get to 2 dimensional arrays yet, but I assume you should just have to add together the aplicable arrray posisions -Greg :-Q

flaga.gif
 
What have you written so far? Post the code, it appears to be a simple error.

--MiggyD It's better to have two heads to solve a problem from different angles than to have tunnel vision to a dead end.
 
Im working on the same kind of Qbasic array but its 3 Col & 3 Row but my book has no good example for how to write the SUB or Function for an Array
 
Example with an 2 dimensional array and a sub-routine:

Code:
DECLARE SUB aSub (twodimarray%(), rows%, columns%)
DEFINT A-Z
CONST r = 2
CONST c = 3
DIM a(r, c)
a(r, c) = 1

CALL aSub(a(), r, c)

SUB aSub (twodimarray(), rows, columns)
    PRINT twodimarray(rows, columns)
END SUB
[\CODE]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top