Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 8th, 2003, 01:52 PM
StevenJ StevenJ is offline
SuperSquirel To The Rescue
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Sterling Heights
Posts: 14 StevenJ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to StevenJ Send a message via MSN to StevenJ Send a message via Yahoo to StevenJ
QBASIC and ARRAYS

in my qbasic program, i keep getting subscript out of range, but am sure i made enough, my program works for the first 2 arrays, but once i add the if then after the ==== it tells me subscript out of range.
this is what is going on >>>

DIM prices(1 TO 7), lestype$(1 TO 7)
FOR n = 1 TO 7
READ prices(n), lestype$(n)
NEXT n
DIM location.total.owed(1 TO 6)
DIM location.names$(1 TO 6)
DIM location.customers(1 TO 6)
DIM location.lessons(1 TO 6)
DIM city$(1 TO 6)
FOR n = 1 TO 6
location.total.owed(n) = 0
location.customers(n) = 0
location.lessons(n) = 0
NEXT n
city$(1) = "Dearborn"
city$(2) = "Canton"
city$(3) = "Novi"
city$(4) = "Southfield"
city$(5) = "Detroit"
city$(6) = "Other"

location.names$(1) = "DEA"
location.names$(2) = "CAN"
location.names$(3) = "NOV"
location.names$(4) = "SOU"
location.names$(5) = "DET"
=================================
locat$ = UCASE$(locat$)

IF locat$ = location.names$(n) THEN
location.total.owed(n) = location.total.owed(n) + 1
location.customers(n) = location.customers(n) + 1
location.lessons(n) = location.lessons(n) + 1
ELSE
location.total.owed(6) = location.total.owed(6) + 1
location.customers(6) = location.customers(6) + 1
location.lessons(6) = location.lessons(6) + 1
END IF

PRINT USING N6$; city$(n); location.customers(n); location.lessons(n); location.total.owed(n)

Reply With Quote
  #2  
Old December 8th, 2003, 10:23 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
What's the locat$ variable define in your code??

Reply With Quote
  #3  
Old December 9th, 2003, 11:14 AM
StevenJ StevenJ is offline
SuperSquirel To The Rescue
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Sterling Heights
Posts: 14 StevenJ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to StevenJ Send a message via MSN to StevenJ Send a message via Yahoo to StevenJ
u read locat$ from the data

Reply With Quote
  #4  
Old December 10th, 2003, 02:19 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
the locat$ variable is a parameter which u input??

Reply With Quote
  #5  
Old December 10th, 2003, 11:07 AM
StevenJ StevenJ is offline
SuperSquirel To The Rescue
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Sterling Heights
Posts: 14 StevenJ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to StevenJ Send a message via MSN to StevenJ Send a message via Yahoo to StevenJ
its in the DATA line after the program, its a program for school, so the data is typed after the program. i dono what parameter means

Reply With Quote
  #6  
Old December 10th, 2003, 11:23 AM
StevenJ StevenJ is offline
SuperSquirel To The Rescue
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Sterling Heights
Posts: 14 StevenJ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to StevenJ Send a message via MSN to StevenJ Send a message via Yahoo to StevenJ
it is valid its working like it is supposed to, the problem is in the arrays

Reply With Quote
  #7  
Old December 12th, 2003, 12:22 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Do u have a mistake in your code,because i couldn't find UCASE$ in QB!

Reply With Quote
  #8  
Old December 12th, 2003, 11:46 AM
StevenJ StevenJ is offline
SuperSquirel To The Rescue
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Sterling Heights
Posts: 14 StevenJ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to StevenJ Send a message via MSN to StevenJ Send a message via Yahoo to StevenJ
UCASE$ like LCASE$ is one of those codes already in the program, it makes something all caps or all lower case.
the problem was in my FOR NEXT i dont understand those, the teacher showed me what i did wrong, but i didn't understand. so if u know a easy to follow tutorial for those with short attention span on FOR NEXT and ARRAYS ill be thankful.

Reply With Quote
  #9  
Old December 14th, 2003, 07:04 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
U can find some tutorial on network for learn QB syntax:http://www.tutorgig.com/showurls.jsp?group=798&index=1

Reply With Quote
  #10  
Old December 15th, 2003, 11:25 AM
StevenJ StevenJ is offline
SuperSquirel To The Rescue
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Sterling Heights
Posts: 14 StevenJ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to StevenJ Send a message via MSN to StevenJ Send a message via Yahoo to StevenJ
thanks man

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > QBASIC and ARRAYS


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway