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
Mashutka [201]
3 years ago
8

Consider this data sequence: "fish bird reptile reptile bird bird bird mammal fish". There is a CONSECUTIVE REPETITION of length

3 (the three consecutive birds) and a CONSECUTIVE REPETITION of length 2 (the two reptiles). There are also several SINGLETONs of length 1 (a singleton fish, a singleton bird, a singleton mammal, and another singleton fish).Write some code that uses a loop to read in a sequence of words, terminated by the "xxxxx". The code assigns to t the number of CONSECUTIVE REPETITIONS that were read. (For example, in the above data sequence that value would be 2.) Assume that t has already been declared but not initialized . Assume that there will be at least one word before the terminating "xxxxx".
Computers and Technology
1 answer:
ioda3 years ago
8 0

Answer:

The code is given below. Follow the question and the code definitions for better understanding.

Explanation:

#include<iostream>

#include<string>

using namespace std;

int main(){

string pastWord="";

string currentWord,nextWord;

int n,t;

int singleton=0;

int consecutive=0;

cout<<"Enter words. ('xxxxx' to exit):\n";

cin>>nextWord;

do{

currentWord=nextWord;

cin>>nextWord;

if ( (currentWord!=pastWord)&&(currentWord!=nextWord) )

singleton++;

else if((currentWord==pastWord)&&(currentWord!=nextWord))

consecutive++;

pastWord=currentWord;

}while(nextWord!="xxxxx");

n=singleton;

t=consecutive;

cout<<"There were "<<n<<" singletons and "<<t<<" consecutive repetitions.";

cin.get();

return 0;

}

You might be interested in
What is a browser? Give one example
Harman [31]
It is a program that may be used by a user to access files and navigate the World Wide Web. An example of this would be Firefox, Chrome, Safari, etc.
3 0
2 years ago
Read 2 more answers
Write the code for invoking a method named sendObject. There is one argument for this method which is of type Customer. Assume t
kodGreya [7K]

Answer:

sendObject(John_Doe);

Explanation:

The above code has been written in Java.

Since the calling class is the same that declares it, to invoke the method, simply call its name with its argument(s) in a pair parentheses. The name of the method is "sendObject" and its argument is a reference to an object of type Customer saved in a variable called "John_Doe". This can be written as follows:

sendObject(John_Doe);

Hope this helps!

3 0
3 years ago
Which operating system function has a steeper learning curve and can potentially break the system without careful use of its ope
grandymaker [24]

Answer:

4. Command line interface (CLI)

Explanation:

An operating system is a system software pre-installed on a computing device to manage or control software application, computer hardware and user processes.

This ultimately implies that, an operating system acts as an interface or intermediary between the computer end user and the hardware portion of the computer system (computer hardware) in the processing and execution of instructions.

Some examples of an operating system on computers are QNX, Linux, OpenVMS, MacOS, Microsoft windows, IBM, Solaris, VM etc.

A Command line interface (CLI) refers to a text-based user interface that allow users to operate a software application or program, as well as manage and execute operating system functions by typing standard line of commands into the text-based user interface with a real-time response.

Basically, the CLI is solely text-based and as such requires a thorough knowledge and understanding of global commands, as well as administrative privileges in some cases.

<em>Hence, the operating system function which has a steeper learning curve (more difficult to learn) and can potentially break the system without careful use of its operations is the Command line interface (CLI). </em>

3 0
2 years ago
Windows uses a memory-management technique known as ________ to monitor which applications you use most frequently and then prel
lukranit [14]

Answer:

SuperFetch

Explanation:

Superfetch is a memory management technique on windows service that enables or fetch frequently use applications on systems and launch them faster because the frequently use applications has been preload into the system memory for easy access when they want to be used.

SuperFetch always takes notice of all application running on your system in which when you exit a frequently used application SuperFetch will preload them immediately since it is saved on the system memory.

One of the most important part of Superfetch is that it saves alot of time because you don't have to search the applications before you get access to them in as far as the application was frequently used.

5 0
2 years ago
What steps should be taken to dispose of and recycle plastic?
WARRIOR [948]
Step 1: Collection. The first step in the recycling process is always collecting the plastic material that is to be recycled. ...
Step 2: Sorting. ...
Step 3: Washing. ...
Step 4: Resizing. ...
Step 5: Identification and separation of plastics. ...
Step 6: Compounding.
3 0
3 years ago
Other questions:
  • LargeCo is planning a new promotion in Alabama (AL) and wants to know about the largest purchases made by customers in that stat
    7·1 answer
  • Analyst is investigating proxy logs and found out that one of the internal user visited website storing suspicious java scripts.
    8·1 answer
  • Sarah, a computer user, tells James, a computer technician, that the network she is connected to is running too slowly. Which of
    5·1 answer
  • _____ creates a border or space that separates information.
    14·1 answer
  • How much will your assignment be docked if you turn it in late?
    7·2 answers
  • Hey mates.........needed asap 1.) Mention and explain four (4) ICT gadgets,
    9·2 answers
  • Match the component to its function. resistor inductor capacitor battery transistor This component stores a temporary charge. ar
    7·2 answers
  • What do you think Amazon should fix?
    13·2 answers
  • What does a hanging indent look like?
    7·1 answer
  • These brainly bots need to stop!!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!