Posts: 1
Threads: 1
Joined: Jun 2003
I am writing a program for school that needs to input a name and and number of minutes used by a band in a studio. It needs to continue asking for a name and minutes until quit is entered. Then it needs to output the band name, the minutes used , and the charges. Then I need a total number of minutes and charges. I am having problems outputing the band names. the way I and doing it only outputs the last name entered. Not all the names.
how am I suposed to keep the band names in memory until it is printed. Here is what I got so far.
CLS
INPUT "Enter the name of the group or quit to end"; group$
INPUT "Enter the number of minutes"; min
DO UNTIL UCASE$(group$) = "QUIT"
total = total + min
INPUT "Enter the name of the group or quit to end"; group$
INPUT "Enter the number of minutes"; min
PRINT group$, total
LOOP
PRINT TAB(30); "Recording Studio Charges"
chrg = (200 / 60) * total
chrg = INT(chrg * 100 + .5) / 100
PRINT "Name of group "; group$
PRINT "Number of minutes"; total
PRINT "Total charges = $"; chrg
END
any help would be apriciated.
Posts: 704
Threads: 0
Joined: Dec 2002
.
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Posts: 199
Threads: 2
Joined: May 2003
You and
atomicfrog in the same class per-chance
http://forum.qbasicnews.com/viewtopic.php?t=2982
url=http://www.spreadfirefox.com/?q=affiliates&id=60131&t=79]
[/url]
END OF LINE
.
Posts: 2,765
Threads: 138
Joined: Nov 2002
Quote:You and atomicfrog in the same class per-chance
http://forum.qbasicnews.com/viewtopic.php?t=2982
I noticed that too!
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Posts: 480
Threads: 24
Joined: Mar 2003
Glenn's suggestion of using an array works fine.
Alternatively, you could open up a text file (chack out the "OPEN" command in QBHelp) and do a loop like you've got there. Each time the user enters a band name and minutes, you could add it to the text file. Then, when they enter quit, you could close the text file, reopen it ("OPEN" again, but this time as INPUT [reading FROM the file] instead of as OUTPUT [writing TO the file]) and print the values one at a time.
Commands needed for glenn's idea:
DIM
other fun, helpful commands: REDIM, TYPE
Commands needed for my idea
OPEN, CLOSE
other fun, helpful commands: EOF
look 'em all up. QBHelp is the best place to learn! Go through and read all the commands some time.
*peace*
Meg.
Posts: 780
Threads: 49
Joined: Dec 2001
Is this a marked assignment? If so, take the above suggestion and output the results to file. It's not something thats beginner, so you should get more marks for it. You should have an array, it will be much easier to manage.
With a file, just output each name as a new line, with like a number of total above that, like:
3
Bob
Bill
Bret
3 names
name1
name2
name3
get it?
Just store a var like countNames% and add 1 to the loop
Pretty strange way, but it works...
Hail.
Posts: 938
Threads: 104
Joined: Dec 2002
LoL THIS IS NOT HELPFUL but...
Glenn! It took me awhile to read the subject title and not just the
.
lol. Nevermind.
ovaProgramming.
One night I had a dream where I was breaking balls. The next morning,
BALLSBREAKER was born.
Quote: Excellent. Now you can have things without paying for them.
BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it
.
-----------------------------
Posts: 704
Threads: 0
Joined: Dec 2002
(Ha. I kill me!)
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Posts: 3,368
Threads: 195
Joined: Jan 2003
Oh, very funny.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 1,845
Threads: 44
Joined: Aug 2002
:o
Believing in reincarnation or life after death or somthing Glenn?