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
In Python write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs
Lilit [14]

Answer:

ansList =input().split() #get input and split it by space

ansList = [int(i) for i in ansList if int(i)>0] #turn string to integer,and get all positive integers

print(ansList)

Explanation: I think this would work for you. I leace comments in the answer.

3 0
1 year ago
In the airline industry, frequent flyer programs, ticket kiosks, and e-ticketing are all examples of capabilities that are _____
crimeas [40]

Answer:

valuable; rare

Explanation:

A valuable capability is that which gives a firm some competitive advantage. Core competencies are the operational activities that a company does best. A business’s core competencies are what distinguish it from other rival companies in its industry. While Rare capabilities are capabilities that a small amount of, if any, competitors possess. Those type of capabilities that are costly or impossible to imitate.

from the above explanation we can deduce that the modern technology implementation in the airline industry has made it possible to have valuable ptograms and softwares for carring out several task which are no longer scarce to procure.

7 0
3 years ago
5.14 Describe how the compare and swap() instruction can be used to provide mutual exclusion that satisfies the bounded-waiting
Naddik [55]

Answer:

Explained below

Explanation:

Compare and Swap(C&S) is simply an atomic operation whereby the compare and swap operations are automatically executed.

Now compare and Swap basically needs 3 arguments namely:

- 2 old values which we will label X and Y

- 1 new value which is written in X that we will call Z

Thus, we now have; C & S = {X, Y, Z}

To explain this well, let X be a variable where X has a value of 7.

Now, if a programmer gives a program me that X be multiplied by 2,then what C&S operation will do is;

I) Y = X where Y is a new variable.

II) Result = C&S(X, Y, X*7)

Variable X is global and this means that mere than one process and more than 1 thread can see the variable X.

Now, if a process named P1 wants multiply the variable X by 7 using C&S operation, it will first make a local copy of variable X (which in this case is now the new variable Y). After that it will atomically compare X & Y and if they are equal, it will replace X with 10X.

However, if they are not equal, P1 will re-read value of X into Y and carry of C&S instruction again.

8 0
3 years ago
When considering the typical characteristics of a server, how is the server optimized in relation to applications?
VLD [36.1K]

Answer: Server are optimized so that they can work efficiently and improve their performance while working. Application server optimization mechanism can be used for optimizing the server with respect to the application.

Some of the techniques used in the application server optimization are as follows:-

  • Load balancing- which helps in upgrading throughput ,improves the time of response, enhance the bandwidth of network etc.
  • Fail-over management- it is used for decrement of latency, balancing the server, increasing the availability of network and it resources etc.

3 0
3 years ago
__________ delivers a comprehensive and accurate graphical overview of key performance indicators, often using a single screen.
Irina18 [472]
The answer is a digital dashboard.

In its simplest form, a digital dashboard or a business dashboard provides a graphical representation of KPIs, measures and metrics used by a company to monitor performance of departments, individuals, teams or the entire company. They track the progress of business objectives and make effective data driven decisions.



6 0
3 years ago
Other questions:
  • Difference between switch case and if else statement.​
    11·1 answer
  • A friend of yours started her own dog walking business. At first she only had a couple customers, and she used Word to create al
    8·1 answer
  • How many miss Dragon Ball Abridged?
    5·2 answers
  • WHAT TYPES OF ACTIVITIES ARE PERFORMED BY HEALTH CARE SOFTWARES
    8·1 answer
  • Which are characteristics of interpreters? Select
    6·2 answers
  • I need help!! I decided to go back to college this year and am taking Intro to Logic and Programming. I have an assignment due t
    5·1 answer
  • What are some innovations that television has undergone since its original invention ?
    11·1 answer
  • Check all that apply to Raster Graphics
    13·1 answer
  • In cell b12 create a formula using max f7nction to calculate maximum value in B4:B9
    7·1 answer
  • What are two reasons to tie cables up and out of the way inside a computer case?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!