C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 21, Problem 21.27MAD
Program Plan Intro
Program Plan:
- Include header files.
- Start "main()" function.
- Make a string array "spam" containing 30 spam sample keywords.
- Declare "spamscore" and "countword" variables to store count of spam words and total words respectively.
- Accept "emailmsg".
- Use stringstream "s" for breaking words of emailmsg.
- Start while loop where words from stringstream "s" goes into string "word". Condition of executing loop is till we have words in stream "s".
- Increment countword.
- Use for loop for value i=1 to 30 for each word in array "spam".
- If word is same as one of spam keywords increase spamscore.
- end for loop
- end while loop
- Display Total Number of words in a message.
- Display Total Number of spam words in a message.
- Using type casting calculate "spampercent" as "((float)spamscore/(float)countword)*100;".
- If "spampercent> 30" then display "It's a spam message". else display "It's not a spam".
- Return and exit "main()" function.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Spam (or junk e-mail) costs U.S. organizations billions of dollars a year in spam-prevention software, equipment, network resources, bandwidth, and lost productivity. 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 phrases. For each occurrence of one of these within the message, add a point to the message’s “spam score.” Next, rate the likelihood that the message is spam, based on the number of points it received.
(must be in ''C'' programming language.)
Entered
Answer Preview
Result
Message
correct
(923,998)
(923,998)
(2398,2171)
(2398, 2171)
correct
(2,808)
(2,808)
Your answer isn't a number
incorrect
(it looks like a list of numbers)
At least one of the answers above is NOT correct.
(1 point) Consider the elliptic curve group based on the equation
y²
= x + ax + b
x3
mod p
where a =
2440, b = 295, and p
=
3391.
We will use these values as the parameters for a session of Elliptic Curve Diffie-Hellman Key Exchange. We
will use P = (2, 808) as a subgroup generator.
You may want to use mathematical software to help with the computations, such as the Sage Cell Server
(SCS).
On the SCS you can construct this group as:
G=Elliptic Curve (GF(3391), [2440,295])
Here is a working example.
(Note that the output on SCS is in the form of homogeneous coordinates. If you do not care about the details
simply ignore the 3rd coordinate of output.)
Alice selects the private key 18 and Bob selects the private key 15.
What is A, the public key of Alice?…
#!/bin/sh # Author : Name of Author #
Copyright (c) information echo "what is your
name?" read PERSON echo "Hello, $PERSON"
With the code above as an example, write short
notes on Shell scripting.
3:39 PM
Chapter 21 Solutions
C++ How to Program (10th Edition)
Ch. 21 - Prob. 21.4ECh. 21 - Prob. 21.5ECh. 21 - (Find Code Error) Find any errors in the following...Ch. 21 - (Simple Encryption) Some information on the...Ch. 21 - Prob. 21.8ECh. 21 - Prob. 21.9ECh. 21 - (String Concatenation) Write a program that...Ch. 21 - (Hangman Game) Write a program that plays the game...Ch. 21 - (Printing a string Backward) Write a program that...Ch. 21 - (Alphabetizing Animal Names) Write a program that...
Ch. 21 - Prob. 21.14ECh. 21 - Prob. 21.15ECh. 21 - Prob. 21.16ECh. 21 - Prob. 21.17ECh. 21 - Prob. 21.18ECh. 21 - (Erasing Characters from a string) Write a program...Ch. 21 - Prob. 21.20ECh. 21 - Prob. 21.21ECh. 21 - Prob. 21.22ECh. 21 - Prob. 21.23ECh. 21 - Prob. 21.24ECh. 21 - Prob. 21.25ECh. 21 - (Cooking with Healthier Ingredients) Obesity in...Ch. 21 - Prob. 21.27MADCh. 21 - (SMS Language) Short Message Service (SMS) is a...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please provide answer in C#: Slot Machine Simulation A slot machine is a gambling device into which the user inserts money and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money that the slot machine dispenses back to the user. Create an application that simulates a slot machine. Figure 8-23 (on page 539 of your book) shows an example of how the form should look. The application should let the user enter into a TextBox the amount of money he or she is inserting into the machine. When the user clicks the Spin button, the application should display three randomly selected symbols. (Slot machines traditionally display fruit symbols. You will find a set of fruit symbols attached to this dropbox for your use - from the Student Sample Programs provided by the book author.) If none of the randomly displayed images match, the program should inform the user that he or she has won…arrow_forwardPosted 4th time answer correctly asap else direct downvotearrow_forwardTrue or false: In order to comment out a line of code, use # in front of the line. (python)arrow_forward
- please code in python A tweet is a string that is between 1 and 280 characters long (inclusive). A username is a string of letters and/or digits that is between 1 and 14 characters long (inclusive). A username is mentioned in a tweet by including @username in the tweet (notice the username does not include the @ symbol). A retweet is way to share another user's tweet, and can be identified by the string RT, followed by the original username who tweeted it. Your job is to fill in the function count_retweets_by_username so that it returns a frequency dictionary that indicates how many times each retweeted username was retweeted.tweets = ["This is great! RT @fakeuser: Can you believe this?", "It's the refs! RT @dubsfan: Boo the refs and stuff wargarbal", "That's right RT @ladodgers: The dodgers are destined to win the west!", "RT @sportball: That sporting event was not cool", "This is just a tweet about things @person, how could you", "RT…arrow_forwardDirection: Answer the following, write your answer in a word document and convert it to pdf file. 1. Create a program that prompt user to input two numbers and displays the six types of relationships for the two inputted numbers. 2. Create a program that applies the concept of login form using logical operators. Username = 25 Password = 12 Sample output: Enter username: 25 Enter password: 12 "You are successfully login" while if wrong input the message is "you are not allowed to login" 3. Create a program that prompt user to input a value for variable a then displays the value of the following assignment operators such as +=, --, *=, /=, %=. int a, b, c Sample output Enter a value for a = 3; Enter a value for b= 3; The value of c = a is: The value of c =+a is: The value of c =-a is: The value of c ="a is: The value of c =/a is: The value of c =%a is:arrow_forward99 question Reza Enterprises sells tickets for buses, tours, and other travel services. Because Reza frequently mistypes long ticket numbers, Reza Enterprises has asked his students to write an application that shows if a ticket is invalid. Your application/program tells the ticket agent to enter a six-digit ticket number. Ticket numbers are designed so that if you lose the last digit of the number, then divide by 7, the remainder of the division is exactly the same to the last dropped digit. This process is shown below: Step 1: Enter the ticket number; for example 123454 Step 2: Remove the last digit, leaving 12345 Step 3: Determine the remainder when the ticket number from step 2 is divided by 7. In this case, 12345 divided by 7 leaves a remainder of 4. Step 4: Display a message to the ticket agent indicating whether the ticket number is valid or not. If the ticket number is valid, save the number to a .txt file called “tickets.txt” and.arrow_forward
- File math.html contains a form that has to be processed with a PHP program that you will write. Perform the following tasks: 1. Show the name of your PHP program and your name in the form. 2. Replace the fixed + sign in the form with a textbox, so that the user can enter + or -. 3. Write and test a PHP program that will do the following: a. Validate that the operation in the textbox corresponds to the operation selected by the radio button in the operation radio button group. b. Validate that the operands are integers with values corresponding to the selection in the grade radio button group. c. Check that the result entered by the user is a correct integer. If so, send a message to the browser and ask for another submission of the form. If not, send to browser an error message and request resubmission of the form. d. Keep track of the number of correct and incorrect answers of the user during the session and include both in the messages that acknowledge a correct result or…arrow_forwardPYTHON PROGRAMMING!! EXTRA CONSTRAINT: MAKE SURE THAT THE CODE ACCEPTS THE INPUT ON THE IMAGE AND OUTPUTS THE RESULT ON THE IMAGE AS WELLYou find yourself in a top-secret mission to infiltrate and disable the nuclear missile silos of a terrorist organization threatening to destroy any country that refuses to surrender. Fortunately, an ally double agent was able to successfully hijack the launch system used by the terrorists. However, in order to not get found out, they could not disable the system outright but they were able to infect the system with an undetectable virus that stops all processes of the system was activated. Through a secure line, the double agent gives you the instructions in order to activate the virus and stop all missiles from firing: In the trash can nearest the main computer, you should be able to get a crumpled piece of paper with a grid of random numbers printed onto it. You will know that it is the right piece of paper if there are the same number of rows and…arrow_forwardFlowchart that converts temperature (Fahrenheit to Celsius, and vice versa)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT