C++ How to Program (10th Edition)
C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
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.

Blurred answer
Students have asked these similar questions
C# (Login User Control) Create a UserControl called LoginPasswordUserControl that contains a Label (loginLabel) that displays string "Login:", a TextBox (loginTextBox), where the user inputs a login name, a Label (passwordLabel) that displays the string "Password:" and, finally, a TextBox (passwordTextBox), where a user inputs a password (set property PasswordChar to "*" in the TextBox’s Properties window). LoginPasswordUserControl must provide public read-only properties Login and Password that allow an app to retrieve the user input from loginTextBox and passwordTextBox. The UserControl must be exported to an app that displays the values input by the user in LoginPasswordUserControl.
Computer Science C Language, please make method as simple and basic as possible thank you :) When creating a social media account, you can get an automatically generated password sent to you 152 days after you create your profile. Write a program that reads the year, month and day of your account creation, and then prints the year, month and day that you become eligible for a new password. Leap years should also be taken into account.
Python: numpy def serial_numbers(num_players):"""QUESTION 2- You are going to assign each player a serial number in the game.- In order to make the players feel that the game is very popular with a large player base,you don't want the serial numbers to be consecutive. - Instead, the serial numbers of the players must be equally spaced, starting from 1 and going all the way up to 100 (inclusive).- Given the number of players in the system, return a 1D numpy array of the serial numbers for the players.- THIS MUST BE DONE IN ONE LINEArgs:num_players (int)Returns:np.array>> serial_numbers(10)array([1. 12. 23. 34. 45. 56. 67. 78. 89. 100.])>> serial_numbers(12)array([1. 10. 19. 28. 37. 46. 55. 64. 73. 82. 91. 100.])""" # print(serial_numbers(10)) # print(serial_numbers(12))
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education