Spam (or junk e-mail) costs organizations billions of dollars a year in spam- prevention software, equipment, network resources, bandwidth, and lost productiv- ity. Research online some of the most common spam e-mail messages and words, and check your own junk e-mail folder. Create a list of 30 words and phrases commonly found in spam messages. Write a program in which the user enters an e-mail message. Read the message into a large character array and ensure that the program does not attempt to insert characters past the end of the array. Then, scan the message for each of the 30 keywords or phrase. for each occurence of these within the message, add a point to the messages "spam score" Next, rate the likelihood that the message is spam, based on the number of points it received. please i need help. programming in c.
Well, this is my first attempt to help anyone out. Forgive me if I don't hit the mark first time. I will, of course, endeavour to follow the guidelines. IMO the first task is to to refrain from considering the implementation language; that is is C implies that it lends itself to a procedural approach. The specification is both helpful and detailed. It provides clues on "boundary value" problems, specifically the population of the end of the array. Am I recanting here? That you are told to use an array and that arrays in C need to be dimensioned at compile time indicates that you need to size it accordingly. It must accomodate the whole of the email message. How will you tell that you're at the end of the message? At that point how will you continue to populate the remainder of the array elements? You may find it helpful to thinks of this as just a a string matching exercise. In one string is the email message. You have a set of match strings. It's your task to pass through the first string counting matching occurences of (say) s1 in S; s2 in S etc. where s1 is one of the keywords and S is the email message. It's hard for me to know how far to go, so please comment on whether I have helped and whether I should continue to try . Bill
This is the text of an email message its contains two of the keywords that identified it as a spam. The PiRATE sat on the deck of the ship drinking rum, telling yarns and singing Sea Shantities to his CReW. Now suppose that you imagine that the email message is written character by character on squared paper from left to right. Above each one of these squares number the square beginning at 0, so above T (of This) is 0 and above i (of is) is the number 6. On a separate piece of paper write out the keywords for which you are looking. For the purposes of this example consider the words to be pirate, crew and cheat. Now take the first of these words and overlay it on the email text. Unless you've used tracing paper you'll need to put it either above or below the email text. Line it up on he first character of the text. Now move it along one character at a time until either you reach the end of the text or until you identify a match. If you start with the word cheat you'll get to the end without finding a match. If you use the word pirate, again you'll reach the end IF you take the case of the characters into account. If you ignore case then you'll find a match. This sort of visualisation of the problem I find useful and is something which I wouid do before beginning to express the program as pseudocode. Try it. I hope this helps and gets your problems solving imagination fired. Bill
Join our real-time social learning platform and learn together with your friends!