Question: In C language. #include #include #include int main( int argc, char *argv[]) { FILE *fin, *fout; int i, j, n; char line[102] = {0}; char

In C language.In C language. #include #include #include int main(int argc, char *argv[]) {

#include

#include

#include

int main(int argc, char *argv[]) {

FILE *fin, *fout;

int i, j, n;

char line[102] = {0};

char key[50][102] = {0}, value[50][102] = {0}, input[102] = {0}, output[102] = {0};

fin = fopen(argv[1], "r");

fout = fopen(argv[2], "w");

fscanf(fin, "%d ", &n);

for (i = 0; i

fgets(line, 102, fin);

// Your code here

memset(line, 0, sizeof(line));

}

fgets(input, 102, fin);

input[strlen(input)-1] = 0;

// Your code here

// output format

fprintf(fout, "%s ", output);

fclose(fin);

fclose(fout);

return 0;

}

Question 3: Symbol Table and Hashed String (30\%) You are given the list of key:value pairs, and a hashed string. Recover the hashed string to its original text. Your program should read the input from the file, and output the answer to another file. The first argument is the input file name, while the second argument is the output file name. Name your program as "lab4-q3.c". Input file: A positive integer n(n50), indicating the number of key:value pairs in the symbol table. Following n lines, the key and value pairs are separated by a colon. Then, one more line for the hashed string. You can assume that the colon does not appear in the keys and the values. Each line has at most 100 characters. However, keys and values may contain spaces. Output file: Output the original texts. You can assume that the hashed string can be uniquely decoded. Sample Input: 4 1:I 01: Love 001:Data 000 : Structures 101001000 Sample Output: ILoveDataStructures

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!