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)
source(2)
source(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
#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; }
\$./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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started