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
denis-greek [22]
3 years ago
15

int replace_text (Document *doc, const char *target, const char *replacement) The function will replace the text target with the

text replacement everywhere it appears in the docu- ment. You can assume the replacement will not generate a line that exceeds the maximum line length; also you can assume the target will not be the empty string The function will return FAILURE if doc, target or replacement are NULL; otherwise the function will return SUCCESS. #de fine DOCUMENT H #de fine MAX PARAGRAPH LINES 20 #de fine MAX PARAGRAPHS 15 #de fine MAX STR SIZE 80 #de fine HIGHLIGHT START STR "[" #define HIGHLIGHT END STR "ן" #de fine SUCCESS #de fine FAILURE - typedef struct { int number of 1ines: char lines[MAX PARAGRAPH LINES 1 [MAX STR SIZE + 11 \ Paragraph; typedef struct { char name [ MAX STR SIZE+ 11 int number of paragraphs; Paragraph paragraphs [MAX PARAGRAPHS]; } Document;
Computers and Technology
1 answer:
Paraphin [41]3 years ago
4 0

Answer:

int replace(Document *doc, const char *target, const char *replacement){

int i, j, k;

int beginning;

char temp[MAX_STR_SIZE + 1] ;

 

char *beginning, *end, *occ, *line;

if(doc == NULL || target == NULL || replacement == NULL)

return FAILURE;

for(i = 0; i < doc->total_paragraphs; i++){

for(j = 0; j < doc->paragraphs[i]->total_lines; j++){

line = doc->paragraphs[i]->lines[j];

beginning = line;

end = beginning + strlen(line);

strcpy(temp, "");

while(beginning < end && (occ = strstr(beginning, target))!= NULL){

len = occ - beginning;

strncat(temp, beginning, len);

strcat(temp, replacement);

beginning = occ + strlen(target);

}

strcat(temp, beginning);

strcpy(doc->paragraphs[i]->lines[j], temp);

}

}

return SUCCESS;

}

Explanation:

  • Loop through total paragraphs and total lines.
  • Store the beginning and ending of paragraph in specific variables.
  • Copy the remainging chars .
  • Finally return SUCCESS.
You might be interested in
1. Identify one modern technology and discuss its development and discuss what future changes might occur that could have an eve
Mnenie [13.5K]

Explanation:

1- The cell phone is a modern technology that has been developing and gaining new features in addition to being just a device for making phone calls. Currently cell phones perform the same tasks as computers, making it possible to exchange information from the internet, share media, etc.

The development of smartphones will still be significant and will impact even more on the lives of all users, as an essential device for communication at work, and through software developed for cell phones that facilitate human life, such as through the possibility of making purchases , order a taxi, carry out bank transactions, etc.

2- A management information system is a technology aimed at organizations, in order to assist a manager in the decision-making process.

An MIS is an intelligent system that uses a large volume of data and information to generate information and solutions so that a manager has a greater chance of analyzing a scenario in the organization, and makes a more effective decision for the company.

The system is derived from procedures and interaction between people, which generates constant learning and improvement focused on organizational decisions.

MIS was created to assist current organizational management, whose processes derive from a large amount of data and information, in addition to the high competitiveness in the market, which requires decisions to be made quickly, effectively and at the lowest cost.

3- The cell phone and the computer are examples of polypotent technologies, that is, those that are used for purposes greater than those for which they were created, for example, the computer was created to compute data, and the cell phone to make telephone calls, but currently perform functions of being media sharing, communication and leisure equipment.

5 0
3 years ago
Trent is a skilled sketch artist who wants to create images for his online portfolio. He is even
Sidana [21]

Answer: A digital tablet

Explanation: a scanner wouldnt show how to draw, a stock image would just show an image, phtot editing is to edit a picture took like to change the light. The answer is Digital tablet because you can draw on it while recording.

8 0
3 years ago
What is the climax of Ralph breaks the internet?
Murljashka [212]

Answer:

As with the real internet, side quests often end up becoming main quests, and Vanellope falls in love with the gritty nature of internet gaming (through Gal Gadot's speed-racer Shank). Ralph Breaks The Internet also ends up going into the dark web and uses that to form the base of the climax of the film.

Explanation:

hope that help thanx

6 0
3 years ago
Write code that generates a random odd integer (not divisible by 2) between 50 and 99 inclusive.
san4es73 [151]

import random

nums = [x for x in range(50,100) if x%2!=0]

print(random.choice(nums))

We use a list comprehension to create a list of the odd numbers between 50 and 99. Then we randomly choose one of those numbers using the random module.

8 0
3 years ago
What is the default letter assigned for the primary hard drive?
SVETLANKA909090 [29]

d drive i think unless ssd

8 0
3 years ago
Other questions:
  • Given positive integer numInsects, write a while loop that prints that number doubled without reaching 200. Follow each number w
    8·1 answer
  • The Circle of Growth
    10·1 answer
  • Explain where and why metallic material or non metallic material have been used in your home​
    8·1 answer
  • In __________ write, the data are stored in the cache, and control returns to the caller. Select one: a. a synchronous b. a buff
    8·1 answer
  • What is not a basic function of a computer?
    10·2 answers
  • What does the CFO of a company do
    14·1 answer
  • When light does not pass through or bounce off an object, it is said to be
    13·2 answers
  • Write an algorithm to check whether the given number is divisible by 2,3 and 6 or not​​
    9·1 answer
  • Given that<br>f(x) = 5x +3.<br>Find f (4)​
    15·2 answers
  • PLEASE HELP THIS IS DUE TODAY!! WILL MARK BRAINLIEST!!
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!