Description:"Design an algorythym that will read a series of integers. The first integer is special, as it indicates how many more integers will follow. Your algorythym is to calculate the sum and average of the integers, excluding the first integer, and display these values to the screen.
CLS
INPUT numberofvalues
count = 0
DO UNTIL numberofvalues = count
count 1 = count
LOOP
How can I make the amount of inputs I have be equal to numberofvalues, and then how do I add them together?
Help with Qbasic homework
-
- DCEmu User with No Life
- Posts: 3516
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Sun Nov 04, 2001 12:34 am
- Location: Birmingham, Al
- Has thanked: 0
- Been thanked: 0
- Contact:
- toastman
- Iron Fist of Justice
- Posts: 4933
- Joined: Sat Nov 10, 2001 3:08 am
- Location: New Orleans
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: Help with Qbasic homework
You really can't be serious.Egotistical EvilN wrote:Description:"Design an algorythym that will read a series of integers. The first integer is special, as it indicates how many more integers will follow. Your algorythym is to calculate the sum and average of the integers, excluding the first integer, and display these values to the screen.
CLS
INPUT numberofvalues
count = 0
DO UNTIL numberofvalues = count
count 1 = count
LOOP
How can I make the amount of inputs I have be equal to numberofvalues, and then how do I add them together?
I can't believe anyone would be teaching QBasic.
No signature.
- henzenmann
- Insane DCEmu
- Posts: 186
- Joined: Wed Jul 12, 2006 4:58 pm
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: Help with Qbasic homework
It is still the best language to design algorythyms.toastman wrote:I can't believe anyone would be teaching QBasic.
-
- Damn Dirty Ape
- Posts: 5031
- Joined: Thu Nov 07, 2002 11:11 pm
- Location: Saugerties, NY
- Has thanked: 0
- Been thanked: 0
Re: Help with Qbasic homework
Um... Well, I think you could do something like this (take into account that I have never actually used Qbasic but I'll try to write BASICy pseudocode--also, the BASIC I use probably differs substantially, and I haven't used it in ages... so this may not work at all.)Egotistical EvilN wrote:Description:"Design an algorythym that will read a series of integers. The first integer is special, as it indicates how many more integers will follow. Your algorythym is to calculate the sum and average of the integers, excluding the first integer, and display these values to the screen.
CLS
INPUT numberofvalues
count = 0
DO UNTIL numberofvalues = count
count 1 = count
LOOP
How can I make the amount of inputs I have be equal to numberofvalues, and then how do I add them together?
Code: Select all
dim nov$
dim numberofvalues%
dim newnumber$
dim count%
dim runningtotal%
dim finalaverage%
INPUT nov
numberofvalues = val(nov)
count = 0
runningtotal = 0
WHILE count < numberofvalues
INPUT newnumber
runningtotal += val(newnumber)
count++
WEND
finalaverage = runningtotal/numberofvalues
-
- DCEmu User with No Life
- Posts: 3516
- Joined: Sun Nov 04, 2001 12:34 am
- Location: Birmingham, Al
- Has thanked: 0
- Been thanked: 0
- Contact:
- Code-Red
- DCEmu Ex-Admin
- Posts: 2601
- Joined: Wed Nov 14, 2001 5:54 pm
- Location: Ontario
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: Help with Qbasic homework
God I'm old. We learned BASIC in school long ago. This took me back a little.
Whats the difference between regular and Q?
Whats the difference between regular and Q?
- henzenmann
- Insane DCEmu
- Posts: 186
- Joined: Wed Jul 12, 2006 4:58 pm
- Has thanked: 0
- Been thanked: 0
- Contact:
Re: Help with Qbasic homework
QBasic was included in later MS-DOS versions. It was a "lite"-version of Quickbasic, which in turn was the predecessor to Visual Basic. The biggest difference to "classic" basic interpreters was its nice IDE, and (as far as I remember) better support for structured programming and data types.
The fact that it has not been officially distributed in over ten years makes it seem strange that someone would actually teach/learn it these days
The fact that it has not been officially distributed in over ten years makes it seem strange that someone would actually teach/learn it these days