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
A developer has the following class and trigger code:public class InsuranceRates {public static final Decimal smokerCharge = 0.0
deff fn [24]

Answer:

InsuranceRates.smokerCharge

Explanation:

To set the baseCost variable to the value of the class variable smokerCharge, the developer needs to replace

Decimal baseCost = XXX;

with

Decimal baseCost = InsuranceRates.smokerCharge;

This is done using the class reference type.

The smokerCharge should be declared in the InsuranceRates class, at first.

For example Ball b;

And then, a new instance of the object from the class is created, using the new keyword along with the class name: b = new Ball();

In comparing to the example I gave in the previous paragraph, the object reference in the program is:

InsuranceRates rates = new InsuranceRates();

Because the smokerCharge is coming from a different class, it can only be assigned to the variable baseCost via the InsuranceRates class to give:

Decimal baseCost = InsuranceRates.smokerCharge;

4 0
4 years ago
Using a custom animation effect, how do you make text appear on a slide letter by letter?
solong [7]

Answer:

Apply an entrance effect, and then set it to By letter in the Effect Options dialog box.

Explanation:

PowerPoint application can be defined as a software application or program designed and developed by Microsoft, to avail users the ability to create various slides containing textual and multimedia informations that can be used during a presentation. Some of the features available on Microsoft PowerPoint are narrations, transition effects, custom slideshows, animation effects, formatting options etc.

To format an image on PowerPoint, you can either use the Artistic Effects or Picture Effects.

Some of the features available on Microsoft PowerPoint are narrations, transition effects, custom slideshows, animation effects, formatting options etc.

Basically, the views that are available on the Microsoft PowerPoint application includes;

1. Slide Sorter.

2. Notes Page.

3. Reading Pane.

4. Presenter view.

Using a custom animation effect, in order to make text appear on a slide letter by letter, you should apply an entrance effect, and then set it to By letter in the Effect Options dialog box.

3 0
3 years ago
Which of the following is a benefit of using technology? a. It increases the number of human service providers in firms. b. It i
o-na [289]

Answer:

The correct option to the following question is b.) It increases quality and productivity of firms .

Explanation:

Advantages of using technology in the business:

  • It increased the quality and the productivity of the firm or business.
  • Automated the business processes with the help of an application and software.
  • It reduced the business cost by having few workers at the workplace and,
  • also increased the mobility of the firm.
  • It helps in effective communication.
6 0
4 years ago
How can E-Commerce Portals ensure Security of online Transactions by Customers?
beks73 [17]
Ffkjlfdhaslkjfhlaksdfhlkajsdfh
6 0
3 years ago
How to creatte a react app without a git hub repository
Sunny_sXe [5.5K]

Answer:

You needn't be on Github. You just need to have the software, like visual code installed on your computer.

If you've got all these things sorted, then you'll be able to make apps without github.

6 0
3 years ago
Other questions:
  • Where should fire extinguishers be stored on a boat?
    7·1 answer
  • A. True
    5·1 answer
  • Flashlights are known as which of the following
    7·2 answers
  • Question 2 (5 points)
    12·1 answer
  • 4. A computer architect boasted that they were able to design a computer in which every instruction occupied exactly thirty-two
    8·1 answer
  • Websites whose URL’s contain tildes (~) are usually published by the government. True or false?
    8·2 answers
  • Which of the following statements is true?A)Implicit data type conversion is performed when you mix values of different data typ
    5·1 answer
  • Project: Math Tutor Program with Error Handling
    9·2 answers
  • Alguien me podria ayudar a hacer este codigo porfavor? en php Desarrolle el código que solicite los datos (desde teclado) Nombre
    10·1 answer
  • Multiple Choice
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!