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
Galina-37 [17]
3 years ago
9

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

cat.", then output is: Censored Ex: If userInput is "Dang, that was scary!", then output is: Dang, that was scary! Note: If the submitted code has 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);
/* Your solution goes here */
return 0;
}
Computers and Technology
1 answer:
Gemiola [76]3 years ago
6 0

Answer:

<em>The program goes as follows</em>

<em>Comments are used to explain difficult lines</em>

#include <iostream>

#include <string>

using namespace std;

int main()

{

string userinput;

getline(cin,userinput);

/* My Solution starts here*/

//Initialize sub string position to 0

int stringpos = 0;

// Declare an iterating variable to iterate through userinput

int startpos;  

//Declare and initialize a determinant variable

int k = 0;

while((startpos = userinput.find("darn",stringpos))!=string::npos)

{

 //If userinput contaings "darn", increase k by 1

k++;

// Go to next string position

stringpos = startpos+1;  

}

//If determinant variable k is p then, userinput does not contain "darn"

if(k==0)

{

 cout<<userinput;

}

//Otherwise, it contains "darn"

else

{

 cout<<"Censored";

}

/* My Solution ends here*/

return 0;

}

See attached for .cpp program file

Download cpp
You might be interested in
I will mark you Brainliest if you could guess how old i am :3
ra1l [238]

Answer:

you are 17

Explanation:

6 0
4 years ago
Why is it important to evaluate the website on which you plan to shop?
DENIUS [597]
It may not be trustworthy, and you risk identity theft.
4 0
3 years ago
Read 2 more answers
________ symbol is used in the "Advanced" section of the time range picker to round down to nearest unit of specified time.
liberstina [14]

Answer:

@(at sign) is the correct answer to the following statement.

Explanation:

Because the following symbol is the "at sign" symbol that is used for the Advanced section in the time range picker that lets the user search for the specified time for the round down the closest entity of a particular period. So, that's why the following answer is correct for the following statement.

8 0
4 years ago
"where is a cookie that is created during a web site visit​ stored?"
tino4ka555 [31]
On the visitor's computer
5 0
3 years ago
Anna has a physical mobility difference, and she uses virtual reality to complete her exercises. To use virtual reality, Anna ne
Zepler [3.9K]

Answer:

Explanation:

The basic concept of virtual reality is that they are a pair of lenses in a headset that allows you to visualize a virtual 3D world and become immersed within it. To do the exercises correctly Anna would need to follow the following basic steps.

Put the virtual glasses over her eyes, complete the exercises in the virtual world, take the virtual glasses off

The headset/glasses need to fit comfortably on her eyes and around her head so that she can clearly see the image on the lenses and so that the headset/glasses do not fall off while she is completing her exercises. Once she is done with her exercises Anna can simply take off her virtual glasses and put them away.

5 0
3 years ago
Other questions:
  • Which of the following correctly describes the reason for quality customer service?
    15·2 answers
  • A software programâs _________ indicates what can legally be done with that program.]
    5·1 answer
  • Magnetic energy can build up in the atmosphere of the sun. When this energy is finally released, it is 10 million times greater
    15·1 answer
  • A _____ attack keeps the target so busy responding to a stream of automated requests that legitimate users cannot get in
    9·1 answer
  • Differences between mechanical and optical mouse <br>Plz help me
    6·1 answer
  • Bobbi owns a protein shake company, which has been trading for 3 years. Her products are stocked in a number of gyms, but the co
    11·1 answer
  • According to the Doppler effect, objects moving away from Earth would have a
    12·2 answers
  • Write a program that prompts the user for an integer and then prints all prime numbers up to that integer.
    7·1 answer
  • What is computer software
    8·2 answers
  • Sumit has created a procedure to draw a boat in Logo and saved it by the name, 'Boat'. Next day, when he tried to type the name
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!