1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ale4655 [162]
3 years ago
5

Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn c

at.", then output is:CensoredEx: If userInput is "Dang, that was scary!", then output is:Dang, that was scary!Note: If the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message.#include #include using namespace std;int main() {string userInput;getline(cin, userInput);int isPresent = userInput.find("darn");if (isPresent > 0){cout << "Censored" << endl; /* Your solution goes here */return 0;}
Computers and Technology
1 answer:
barxatty [35]3 years ago
6 0

Answer:

#include <string>

#include <iostream>

using namespace std;

int main() {

string userInput;

getline(cin, userInput);

// Here, an integer variable is declared to find that the user entered string consist of word darn or not

int isPresent = userInput.find("darn");

if (isPresent > 0){

cout << "Censored" << endl;

// Solution starts here

else

{

cout << userInput << endl;

}

// End of solution

return 0;

}

// End of Program

The proposed solution added an else statement to the code

This will enable the program to print the userInput if userInput doesn't contain the word darn

You might be interested in
1. A device that can be used to insert data into a computer or other computational devices is
Pie

Answer:

Examples of input devices include keyboards, mouse, scanners, digital cameras, joysticks, and microphones.

Explanation:An input device is a piece of computer hardware equipment used to provide data and control signals to an information processing system such as a computer or information appliance.

7 0
3 years ago
Read 2 more answers
How would GIS, GPS, or remote sensing technology be used to evaluate the destruction caused by a tornado in Oklahoma?
emmainna [20.7K]

Answer:

They can be used to compare a certain region before and after disaster.

Explanation:

4 0
4 years ago
Margaret O'Connor is an upcoming poet from Georgia who recently updated her blog with her piece of writing titled, Shadows. One
fenix001 [56]

Answer:

The answer is "option D"

Explanation:

Plagiarism is the way of stealing some other person's ideas or words and using them as their work. It is divided into four parts that are Direct Plagiarism, Self Plagiarism, Mosaic Plagiarism, and Accidental Plagiarism. In the given question other options are not correct that can be described as:

  • In option A, It is software that is used to provide someone else's identity.
  • In option B, It refers to white-collar crime, in which the property transfer to he or she are misallocated by a person or entity.
  • In option C, It is a method that is used to increase the speed of a computer by using high-speed RAM.  

3 0
3 years ago
What protect equipment from too much current by tripping a switch that breaks the circuit, stopping the flow of electricity
Svetlanka [38]
By the way i undersood the question it is most probably a fuse because as soon as a current above the one that is meant to pass passes it melts thus breaking the circuit
3 0
3 years ago
Please Tell Me How To Code This
bulgar [2K]

The program is an illustration of string manipulations.

String manipulation involves splitting and replacing characters of a string.

The program in Java, where comments are used to explain each line is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

    //The next two lines declare all variables, as strings and double

 String ddate,desc;

 double weight, price;

 //This creates a scanner object

 Scanner input = new Scanner(System.in);

 //This prompts the user for date, and also gets its input

 System.out.print("Date (MM/DD/YY): ");  ddate = input.nextLine();

 //This prompts the user for item description, and also gets its input

 System.out.print("Description: ");  desc = input.nextLine();

 //This prompts the user for price per pound, and also gets its input

 System.out.print("Price per pound: ");  price = input.nextDouble();

 //This prompts the user for weight, and also gets its input

 System.out.print("Weight: ");  weight = input.nextDouble();

 

 //This replaces all slashes (/) in the date by dash (-)

 ddate = ddate.replace("/", "-");

 

 //This prints the first three characters of the item description

 System.out.println("Description: "+desc.substring(0, 3));

 //This prints the date

 System.out.println("Date: "+ddate);

 //This prints the item price per pound

 System.out.println("Price per pound: "+price);

 //This prints the item weight

 System.out.println("Weight: "+weight);

 //This prints the total price of the item

 System.out.println("Total: "+(weight*price));

}

}

At the end of the program, all user inputs are printed

See attachment for sample run.

Read more about similar programs at:

brainly.com/question/15520075

4 0
2 years ago
Other questions:
  • Software that interprets commands from the keyboard and mouse is also known as the A.hard drive.B.operating system.C.desktop or
    7·2 answers
  • You are writing a report using a template provided by your supervisor. If you increase the margins around your pages by 30 perce
    5·1 answer
  • Bloodborne pathogens travel by way of blood cells and can only be spread by person-to-person contact with infected blood
    5·2 answers
  • Which of the following is a beneficial reason to extract mineral resources from the earth?
    13·2 answers
  • 6) Sometimes it is difficult to read a piece of code and understand what the code will do. For this reason, you may want to add
    9·1 answer
  • What are the advantages to using a linked implementation as opposed to an array implementation?
    8·1 answer
  • What is the amount of work you must input in order to move the stone?
    13·1 answer
  • Which model represents any process in general?
    6·1 answer
  • I need help thanks please!
    8·2 answers
  • Html quickly evolved through specifications that are the result of the collective work of the organization known as the ____.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!