Computing.Net > Forums > Programming > Stuck on GW-Basic! Help please!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Stuck on GW-Basic! Help please!

Reply to Message Icon

Name: Adrian Wison
Date: October 1, 2002 at 08:15:45 Pacific
OS: Windows XP Pro
CPU/Ram: 256
Comment:

Ok, this is my last request for GW-Basic help. I am completly stuck for some reason when i know I can make this program if my mind was right but it isn't. I need a program that will print the total amount made by each department and want the data to be oranized in something like a bar graph. Here is a example on what I need the final print out to look like...

MONTHLY SALES REPORT

DEPARTMENT NAME SALES IN $1,000
ELECTRONICS ***************
WOMEN'S *************
MEN'S ********
FURNITURE ***********
GIFTS ********
APPLIANCES ************
CHILDREN'S *****

Now they started me with two different data sets with one containing the number and name and one with the department number and sales. Sounds confusing? Well you aren't the only one :-) It said to use a binary search to find the subscript for a particular department number which makes no sense to me but for you real programmers may understand. They also say to use a for-next loop to print the correct # of asterisks for the fake bar graph. It isn't a lot but here is what I have so far for the program...

10 GOSUB 100 'PRINT HEADER
20 GOSUB 150 'READ INFORMATION
20 GOSUB 200 'PRINT DEPARTMENT NAME
99 END
100 '**PRINT HEADER**
110 PRINT "MONTHLY SALES REPORT"
115 PRINT "--------------------"
120 PRINT ""
130 PRINT "DEPARTMENT NAME SALES IN $1,000"
140 PRI---------"
149 RETURN
150 '**READ INFORMATION**
160 READ DEPARTMENT.NUMBER
165 READ DEPARTMENT.NAME$
170 READ DEPARTMENT.SALE
199 RETURN
200 '**PRINT DEPARTMENT NAME**
210 PRINT DEPARTMENT.NAME$
299 RETURN
30000 '**DEPARTMENT NUMBER / NAME**
30010 DATA 150006, "FURNITURE"
30020 DATA 175695, "ELECTRONICS"
30030 DATA 217361, "APPLIANCES"
30040 DATA 254597, "WOMEN'S"
30050 DATA 352091, "CHILDREN'S"
30060 DATA 519476, "MEN'S"
30070 DATA 648457, "GIFTS"
30099 DATA 0, "EOF"
30100 '**DEPEARTMENT NUMBER / SALES**
30110 DATA 150006, 11
30120 DATA 175695, 15
30130 DATA 217361, 12
30140 DATA 254597, 13
30150 DATA 352091, 5
30160 DATA 519476, 8
30170 DATA 648457, 8
30199 DATA 0, 0

Well thats about it. If you can help me out on this please do so because after this I will start c+ and all that other good stuff. Just have to get this gwbasic crap out the way.



Sponsored Link
Ads by Google

Response Number 1
Name: tech-fred
Date: October 2, 2002 at 00:37:42 Pacific
Reply:

If you can't do it in basic what makes you
think that you can do it in C. At least
you won't crash the machine in BASIC.


0

Response Number 2
Name: Adrian Wilson
Date: October 2, 2002 at 19:02:48 Pacific
Reply:

Well I can give it a try in C.


0

Response Number 3
Name: Don't take the GW Ba
Date: October 3, 2002 at 09:37:20 Pacific
Reply:

hostile. Literally, I myself never originally liked programming because of the inflexibility and cluttered look of old Basics with their line numbers. They really look and function like crap - just pull your head off and spin around trying to make sense of the jumble. Line 2000 goes to line 3456 to line 1235, then it goes to line 2365 and back to ???? except when a1 then goto ????

Then out came QBasic and other similar languages which were more free-style. I fell into programming much quicker and easier because I could follow program flow by eye and not by jerking around with a slew of often meaningless line numbers.

When you get into a language, any language, that doesn't glue itself to line numbers and allows for an intelligent, systematic programming process, you learn a lot more.

In fact, whoever is having you do this in GWBasic reeks of incompetence: if you are taking any class or course, I pity you. If you are paying for it, I pity you more as you are stuck with idiots for teachers and giving them money to be idiots. If you are self-studying: STOP! and get a real BASIC version or go right to C.

GWBasic is so archaic and will lead to such terrible programming miss-conceptions that only a real moron would use it - someone who wants to eliminate competition in the programming feild by eliminating programmers.

Indeed, basic (not visual basic and the like, but the old "basic" types) itself is a bad programming language for learners. I dinked around in QBasic a few weeks ago and found I had forgotten that QBasic creates variables on the fly and thus doesn't check to make sure you use the right name for them all the time. And thus when I was using the wrong names it wasn't telling me and I was screwing everything else up. When you have a hundred lines and one variable miss-spelling of "oldnme" instead of "oldname" it get's annoying.

Having a language that is specific and will not work without correct variable declaration in itself is a huge boon because then it'll bitch when you type "BlckDog" instead of "BlackDog" (note that I left out the one letter in "aBlackDog" which QBasic won't catch but C will!)

GWBasic is an awful language to torture anyone with.

Try it in C and post some code and people will probably be much happier in helping. The program is easy, but the language you are using (GWBasic) stinks.


0

Response Number 4
Name: David
Date: October 6, 2002 at 17:46:11 Pacific
Reply:

Adrian, I've forgotten exact GWBasic syntax, but it seems you want code something like this:
Print Department.Name$,
For I = 1 to Department.Sales
print "*";
next I
print

The comma cause the next item to be printed on the same line, but tabbed over. The semicolon causes the next item to be printed in the next space on the same line. There are other perhaps more eleganr ways to do this.

Programming logic is the same in all programming languages. Some are easier to learn and use others are more "powerful". Some encourage "sloppy" programming, some a more structured form.

THe BASIC language was an attempt to take programming away from the exclusive hands of the programming "priests", by developing a language which used a clear simple english-like syntax. But programmers became alert to the danger and realized that if this trend continued, everyone would be able to write the programs they wanted and "professional programmers" would be out of a job. So they first maligned it, then destroyed it or swelled it into the "Visual Bloat". If the development of Quick Basic (not QBasic) had continued, it would have become a powerful as C without the arcane syntax and the danger of crashing your entire system and would probabably replaced all other programming languages!


0

Response Number 5
Name: Adrian Wilson
Date: October 7, 2002 at 07:10:19 Pacific
Reply:

Thanks for the help. I will give it a try today to see if it works, if not i'll let you know. Also, thanks for the information!


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

java program help Invalid pragma option in ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Stuck on GW-Basic! Help please!

GW-Basic Help!!! www.computing.net/answers/programming/gwbasic-help/3619.html

Contact for GW-BASIC help www.computing.net/answers/programming/contact-for-gwbasic-help/5056.html

Stuck on passing info between class www.computing.net/answers/programming/stuck-on-passing-info-between-class/5710.html