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]
2 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]2 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
About ___% of children score within one standard deviation above or below the national average in intelligence.
goldfiish [28.3K]
The question is not influenced by the fact that it's about intelligence -  standard deviation is a way of describing data and it's the same for all kinds of data.

So in general, one  standard deviation away from the mean in both directions encompases around 66% of the cases - so here it would be 66% of children.

Additionally, 95% of all children should lie withing two standard deviations - so two standard deviations below or above the average.
4 0
3 years ago
If a computer is not working properly,the best thing to do is ________?
attashe74 [19]
I think that its C. Report the issue to the teacher.
8 0
2 years ago
Read 2 more answers
When you use the bufferedreader class, you must import the ____ package into your program?
BigorU [14]
When you use the bufferedreader class, you must import the java.io package into your program.  It is<span> an API that comes with </span>Java<span> which is aimed at reading and writing data (input and output). ... For instance, read data from a file and write to a file or write a response back over the network. The </span>Java IO<span> API is located in the </span>Java IO<span> package ( </span>java.io<span> ).</span>
5 0
3 years ago
Coordinate with
Lunna [17]

Answer:

First blank: producer

Second blank: Hairdressers

5 0
3 years ago
How to send an email to multiple recipients individually.
zheka24 [161]

Answer:

The BCC method

Explanation:

4 0
2 years ago
Other questions:
  • If your DTP document contains watermarks on every page, where can you place them?
    13·2 answers
  • A _________ is the broadcast of various types of media over the web.
    10·2 answers
  • Lube job---------$18.00
    14·1 answer
  • A common technique for masking contents of messages or other information traffic so that opponents can not extract the informati
    14·1 answer
  • Given the code segment below, complete the assignments as stated in the comments. struct aaa { int m; int nn; } struct bbb{ stru
    13·1 answer
  • Computer hardware without software is useless while computer software without hardware is meaningless. Discuss. Plz provide exam
    15·1 answer
  • Which type of storage disk and disk drive can you use in the given situation?
    12·1 answer
  • Que es tarjeta madre resumen porfa
    13·2 answers
  • Which terms represent the two types of client requirements?
    7·2 answers
  • Which command os used to find a particular word in a document ?<br>​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!