Starting from:

$25

CPD-Exercise 2 Solved

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]
 

More products