Page 1 of 1

Printing array problem

Posted: Mon Apr 07, 2008 8:19 pm
by rexykik
I have the following program, and when i run it, it prints the lines from the array on separate lines instead of in the same print field. How can i get them to print within the same row of my column?

bbscores.txt is outputted in my next post.

'Program: BBtotals
'Programmer: Karl Schuttler
'Date: April 4, 2008
DECLARE SUB B000InputData ()
DECLARE SUB B010PlayerTotals ()
DECLARE SUB B020GameTotals ()
CLS
CONST intPlayers = 10
CONST intGames = 3
DIM SHARED sngScores(intPlayers, intGames) AS SINGLE
CALL B000InputData
CALL B010PlayerTotals
CALL B020GameTotals
END

SUB B000InputData
DIM intPlayerCount AS INTEGER
DIM intGameCount AS INTEGER
OPEN "bbscores.txt" FOR INPUT AS #1
intPlayerCount = 1
DO WHILE intPlayerCount <= intPlayers
intGameCount = 1
DO WHILE intGameCount <= intGames
INPUT #1, sngScores(intPlayerCount, intGameCount)
intGameCount = intGameCount + 1
LOOP
intPlayerCount = intPlayerCount + 1
LOOP
CLOSE #1
END SUB

SUB B010PlayerTotals
DIM intPlayerCount AS INTEGER
DIM intGameCount AS INTEGER
DIM sngPlayerTotal AS SINGLE
PRINT , "Game", "Game", "Game", "Player"
PRINT , "1", "2", "3", "Ave"
PRINT
intPlayerCount = 1
DO WHILE intPlayerCount <= intPlayers
PRINT "player"; intPlayerCount,
sngPlayerTotal = 0
intGameCount = 1
DO WHILE intGameCount <= intGames
PRINT sngScores(intPlayerCount, intGameCount)
sngPlayerTotal = sngPlayerTotal + sngScores(intPlayerCount, intGameCount)
intGameCount = intGameCount + 1
LOOP
sngPlayerTotal = sngPlayerTotal / intGames
PRINT sngPlayerTotal;
intPlayerCount = intPlayerCount + 1
LOOP
END SUB

SUB B020GameTotals
DIM intGameCount AS INTEGER
DIM intPlayerCount AS INTEGER
DIM sngGameTotal AS SINGLE
PRINT
PRINT "Game Total",
intGameCount = 1
DO WHILE intGameCount <= intGames
sngGameTotal = 0
intPlayerCount = 1
DO WHILE intPlayerCount <= intPlayers
sngGameTotal = sngGameTotal + sngScores(intPlayerCount, intGameCount)
intPlayerCount = intPlayerCount + 1
LOOP
PRINT USING " ###"; sngGameTotal;
intGameCount = intGameCount + 1
LOOP
END SUB

Posted: Mon Apr 07, 2008 8:20 pm
by rexykik
12
15
18
10
11
12
4
6
7
0
9
8
0
0
0
20
22
24
0
1
2
5
0
1
0
9
13
4
0
5

Re: Printing array problem

Posted: Tue Apr 08, 2008 12:58 am
by Mac
rexykik wrote:How can i get them to print within the same row of my column?
Put a semi-colon at the end of
PRINT sngScores(intPlayerCount, intGameCount)

Like this
PRINT sngScores(intPlayerCount, intGameCount);

Right?

Mac

You there?

Posted: Mon Apr 14, 2008 10:18 am
by Mac
Any chance you will thank me or ask for further info?

Let's not be an Ephemeralus

Mac