Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with loading words from notepad please!
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
vindicta




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
HeavenAgain




PostPosted: 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
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
vindicta




PostPosted: 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
HeavenAgain




PostPosted: Thu Dec 13, 2007 5:00 pm   Post subject: RE:Help with loading words from notepad please!

OH ok sorry my bad Sad
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 Wink this should speed up a little
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
vindicta




PostPosted: 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.
HeavenAgain




PostPosted: 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 Rolling Eyes although i could be wrong, again Crying or Very sad
Sponsor
Sponsor
Sponsor
sponsor
vindicta




PostPosted: 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.
vindicta




PostPosted: 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.
HeavenAgain




PostPosted: 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
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
vindicta




PostPosted: 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
Tony




PostPosted: 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
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
vindicta




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 27 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: