[SOLVED] CPD-Exercise 2

30.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

Let’s continue to extend the program that can do word replacement in an article(ie. Exercise #1). Please add at least three parameterized macros in the program and these parameterized macros need handle critical parts related to the output. The trivial parameterized macros like #define PRINT(n) printf(“%s”, n) will not be included in the three parameterized macros.

Moreover, you need to use the conditional compilation as a debugging tool. When the program is in the debug mode, you must show the information like the table of output below.

The table below shows the example input and output. The underscored number is the input from users.

Input
Output
Enter pattern, replacement, and at most one parameter: he it Enter the article:

The debug test.
this is case 0 the word is: The Tit the word is: debug the word is: test
Enter pattern, replacement, and at most one parameter: he it -i Enter the article:

The debug test.
this is case 1 the word is: The Tit the word is: debug the word is: test
Enter pattern, replacement, and at most one parameter: he
The input format: string1 string2 [parameter]

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.