Question: First, make a C program which reads the pairs of strings, source and destination and store them into the file dictionary.txt. The maximum length of

First, make a C program which reads the pairs of strings, source and destination and store them into the file dictionary.txt.

The maximum length of the strings is 32.

The first line of the input is N, the number of pairs. At the following lines i (i

The format of the dictionary.txt is as follows:

source(1)destination(1)

source(2)destination(2)

source(N)destination(N)

-------------------------------------------------------------

Then, read strings from standard input and translate the string using dictionary.txt and output the translated string. If the dictionary does not contain a string, the program should output the original string.

The program continue to try to translate the string until user input end.

------------------------------- For reference -----------------------------------

#include #include

#define MAX_STR 32

void makeDictionary() {

}

void translate(char* input, char* translated) {

}

int main() { // Implement readDictionary for Exercise 13-1 makeDictionary();

//// Uncomment the following block for Exercise 13-2 and implement transate function. // while (1) { // char input[MAX_STR]; // scanf("%s", input); // if (strcmp(input, "end") == 0) { // break; // }

// char translated[MAX_STR]; // translate(input, translated); // printf("%s ", translated); // }

return 0; }

First, make a C program which reads the pairs of strings, source

\$./a.out 2 apple pomme pear poire apple pomme banana banana pear poire end \$

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!