Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

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 ASP Free Forums Sponsor:
  #1  
Old January 4th, 2005, 07:34 AM
~sikka~ ~sikka~ is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Norway
Posts: 38 ~sikka~ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 4
matrix problems

Hi.

I am trying to make a code that asks you to enter 13 different words. Its supposed to stop if you enter more or less.

Also the same word cant be entered twice.

Then its supposed to count how many times each letter is used.

Any tips on how to fix my code?

Code:
<SCRIPT type="text/vbscript" LANGUAGE="vbscript">
  
  <!--
  
  dim strInput, arrMatrise, i
  strInput = inputBox ("Skriv inn 13 forskjellige ord: ")
  arrMatrise = split(strInput," ")
  
  if UBound(arrMatrise) > 12 then
  alert "Du har skrevet inn flere enn 13 ord. Vennligst prøv på nytt."
  exit function
  end if
  
  if UBound(arrMatrise) 12 then
  alert "Du har skrevet inn færre enn 13 ord. Vennligst prøv på nytt"
  exit function
  end if
  
  for i = UBound(arrMatrise) - 1 To 0 Step -1
  for j = 0 To i if arrMatrise(j) > arrMatrise(j+1) then
 temporary = arrMatrise(j+1)
  arrMatrise(j+1) = arrMatrise(j)
  arrMatrise(j) = temporary
  end if
  next
  next
  
  for i = UBound(arrMatrise) - 1 To 0 Step -1
  for j = 0 To i
  if arrMatrise(j) = arrMatrise(j+1) then
  alert "Obs, du har brukt ett av ordene mer enn en gang. Vennligst prøv på nyttt"
  exit function
  end if
  next
  next
  
  
  
  -->
  </SCRIPT>
  

Reply With Quote
  #2  
Old January 4th, 2005, 09:40 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
that code you have looks like it should input for string, split it into words and sort it, expecting 13 different words. the basic logic is fine, and except obvious problems in the syntax (probably copy&paste problem) the code looks fine. so if you want us to help you fix, first let us know exactly what is wrong with the code. you get error? if so, post here the full error message and code causing it.

Reply With Quote
  #3  
Old January 4th, 2005, 10:02 AM
~sikka~ ~sikka~ is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Norway
Posts: 38 ~sikka~ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 4
I dont see those obvious problems you are talking about. I am fairly new in this, and I probably have forgotten something stupid.

My first problem is that it doesnt show up an input-box in the browser.

And then I need some tips on how to make it show up a list that counts how many time each letter is put in.

Reply With Quote
  #4  
Old January 4th, 2005, 02:31 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
oh, I thought you had working code you written or found somewhere. where did that code come from then?
anyway, if you want it would be client side you better use javascript - vbscript will work only for IE browsers and nowdays the other browsers are taking 10% of the market - not so minor anymore.
please let us know exactly what you intend to do with this list of letters - if you want it saved in database for example, you'll have to use ASP code and it would be big difference in both code and approach.
if you want it client side, let me know if you have basic programming skills and I can guide you through the needed steps to create such code in javascript... writing fully working code would take some time.

Reply With Quote
  #5  
Old January 4th, 2005, 04:01 PM
~sikka~ ~sikka~ is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Norway
Posts: 38 ~sikka~ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 4
Me and another person have written that code. I have basic skills, but obvious holes in my knowledge

I need it to be VBscript, its for a school assignment I am working on this.

I dont need a database, I can just bubble sort these letters, but cant think of how to start doing this, my brain is kinda fried...

Reply With Quote
  #6  
Old January 5th, 2005, 02:35 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
is it for web page at all or for stand-alone vbscript file (pure vbscript assignment)?

Reply With Quote
  #7  
Old January 7th, 2005, 04:31 AM
~sikka~ ~sikka~ is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Norway
Posts: 38 ~sikka~ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 4
its for a webpage. But the vbscript is the only thing on the webpage.

Reply With Quote
  #8  
Old January 7th, 2005, 05:34 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
so you really better use javascript, which will work on more browsers - vbscript is for IE only. if you insist on vbscript, you can achieve what you want by having array with 26 items, one item for each letter, loop through the words and use Asc(Mid(str, x, 1)) to get ascii value of each character in the string, thus finding its place in the array. when I'll have more time I'll give more code if you need.

Reply With Quote
  #9  
Old January 7th, 2005, 02:31 PM
~sikka~ ~sikka~ is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Norway
Posts: 38 ~sikka~ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 4
My only option is to use VBscript. Thats what the school project is about.

Reply With Quote
  #10  
Old January 7th, 2005, 08:13 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
ok, so use the way I suggested... let me know if you have problems I'll try to help but I can't give you full code. you'll have to do that yourself.

Reply With Quote
  #11  
Old January 10th, 2005, 07:05 AM
~sikka~ ~sikka~ is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Norway
Posts: 38 ~sikka~ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 4
ok I need help figuring out how to count these things.

this is what I got... and I can tell its wrong but not how to fix it

Code:
 for i = UBound(arrMatrise) - 1 To 0 Step -1 
 for j = 0 to i
 if arrMatrise(j) = arrMatrise Asc(Mid(str, x, 1)) then
 
 end if 
 next

Reply With Quote
  #12  
Old January 10th, 2005, 07:21 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,266 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355987 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 12 h 6 m 3 sec
Reputation Power: 1791
I have no idea what you try to do in those loops if you can explain I might be able to help.

Reply With Quote
  #13  
Old January 10th, 2005, 07:25 AM
~sikka~ ~sikka~ is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Norway
Posts: 38 ~sikka~ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 4
I am trying to do that thing you told me to.

Quote:
if you insist on vbscript, you can achieve what you want by having array with 26 items, one item for each letter, loop through the words and use Asc(Mid(str, x, 1)) to get ascii value of each character in the string, thus finding its place in the array. when I'll have more time I'll give more code if you need.


I am sorry but I am a newbie in this, and I have big holes in my knowledge...

Changed it a bit now...

Code:
  for i = UBound(arrMatrise) - 0 To 26
  for j = 0 to i
  document.write arrMatrise Asc(Mid(str, x, 1)) 
  next
  next
  exit function

Reply With Quote