Author |
Message |
vindicta
|
Posted: Thu Dec 13, 2007 4:40 pm Post subject: Help with loading words from notepad please! |
|
|
For class i had to find words that when added up = 95 if a=1, b=2,c=3 ect. I made a program that can total up the word that you type in which was helpful but still too slow. Is there a way that i can put a bunch of words in notepad and my program will check each word individually to see if they total up to something. Please help if you know anything.
Spencer |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
HeavenAgain
![](http://compsci.ca/v3/uploads/user_avatars/139122102045e603120b143.jpg)
|
Posted: Thu Dec 13, 2007 4:53 pm Post subject: RE:Help with loading words from notepad please! |
|
|
if you want ALL the possibile letters formed by the sum, the only way is to do it with brute froce, but there are endless possibilities, since a=1 and total is 95, and (95 as = total of 95)
there must be some restriction to this |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Dec 13, 2007 4:55 pm Post subject: RE:Help with loading words from notepad please! |
|
|
easy, once you're familiar with loops and reading from a file. There are tutorials for both in the tutorials section. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
vindicta
|
Posted: Thu Dec 13, 2007 4:56 pm Post subject: Re: Help with loading words from notepad please! |
|
|
What I mean is this: say I pasted a basic text file in notepad, such as the reply i'm posting now, can i make a program that will check the first word and see its value, then the next and checks all of them until its done and then tells me which words had 95 |
|
|
|
|
![](images/spacer.gif) |
HeavenAgain
![](http://compsci.ca/v3/uploads/user_avatars/139122102045e603120b143.jpg)
|
Posted: Thu Dec 13, 2007 5:00 pm Post subject: RE:Help with loading words from notepad please! |
|
|
OH ok sorry my bad
consider this, since there are 26 alphabets in english (i could be wrong) a-z and z is 26, and you are looking for the sum of 95
so we use 95 divided by 26, and you get 3.something, which means the word's minimum length must be 4, so then you check for all the words that are length of 4 or more this should speed up a little |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Dec 13, 2007 5:00 pm Post subject: RE:Help with loading words from notepad please! |
|
|
yes.
Though an important distinction is that you don't just paste the words into an application -- you save that as a text file, and then have your program read from the text file. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
vindicta
|
Posted: Thu Dec 13, 2007 5:05 pm Post subject: RE:Help with loading words from notepad please! |
|
|
HeavenAgian, I dont think you understand the question:p. There is no limit to the length of the word, you just total up individual words for example, Halloween is 95 because h=8 and a=1 and l=12 ect so when you total 8+1+12+12 and all the others you get 95.
And yes Tony, thats what i meant. It's just that im not familiar with loading data from text file. I am reading up now. |
|
|
|
|
![](images/spacer.gif) |
HeavenAgain
![](http://compsci.ca/v3/uploads/user_avatars/139122102045e603120b143.jpg)
|
Posted: Thu Dec 13, 2007 5:10 pm Post subject: RE:Help with loading words from notepad please! |
|
|
well, you do want to speed up the process of getting the word which add up to 95
and words such as "I am The One" they cant possibily make up the sum of 95, because the max you can have is "zzz" which is 26x3, so you can skip any words that have the length of less than 3
that was what i meant although i could be wrong, again ![Crying or Very sad Crying or Very sad](images/smiles/icon_cry.gif) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
vindicta
|
Posted: Thu Dec 13, 2007 5:12 pm Post subject: RE:Help with loading words from notepad please! |
|
|
ok, yes. you're right there. I thought you meant that the words had to be less than 3 characters. But so far i've just been trying words that look like they might have 95 rather than trying everything. |
|
|
|
|
![](images/spacer.gif) |
vindicta
|
Posted: Thu Dec 13, 2007 5:22 pm Post subject: Re: Help with loading words from notepad please! |
|
|
Ok, I've been reading the tutorial about loading data but i still have no clue how to check each individual word. |
|
|
|
|
![](images/spacer.gif) |
HeavenAgain
![](http://compsci.ca/v3/uploads/user_avatars/139122102045e603120b143.jpg)
|
Posted: Thu Dec 13, 2007 5:25 pm Post subject: RE:Help with loading words from notepad please! |
|
|
i never done reading files in turing, but im assuming you read line by line
each time you read, (a string is returned) so, you will get a string of the current line
and you can go from there with a loop or a "split" method |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Dec 13, 2007 5:26 pm Post subject: RE:Help with loading words from notepad please! |
|
|
well how are you checking each individual word now? There shouldn't be much of a difference. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
vindicta
|
Posted: Thu Dec 13, 2007 5:26 pm Post subject: RE:Help with loading words from notepad please! |
|
|
That's the thing, I have no idea:p |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Thu Dec 13, 2007 5:28 pm Post subject: Re: Help with loading words from notepad please! |
|
|
what?
vindicta @ Thu Dec 13, 2007 4:40 pm wrote: I made a program that can total up the word that you type in
you've made a program and don't know how it works? ![Confused Confused](http://compsci.ca/v3/images/smiles/icon_confused.gif) |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
vindicta
|
Posted: Thu Dec 13, 2007 5:29 pm Post subject: RE:Help with loading words from notepad please! |
|
|
oh, yeah. I made a program that only checks a word you type in. I want to make one that self checks each word in a group of text. |
|
|
|
|
![](images/spacer.gif) |
|