Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C programm 2. (50 points) A key array of an ordering of the digits 0 to 9 can be used to encode an array
In C programm
2. (50 points) A key array of an ordering of the digits 0 to 9 can be used to encode an array of integers in the range of 0 to 9. Write a program that replaces the numbers in an integer array with each number's index in the key array. For example, if the key array, as an ordering of the digits 0 to 9, is 9012847563, then the integer array(3, 5, 1) will be encrypted as (9,7, 2) because 3 is at index 9 in the key array, 5 is at index 7, and 1 is at index 2. A sample input/output: Enter the size of the input array: 6 Enter the number: 7 0 3 1 7 8 Key array: 4.75 6 0 2 3 1 9 8 Output: 1 4 6 7 1 9 1) Name your program encode.c. 2) In the main function, the program will ask the user to enter the size of the input array, elements of the input array, the key array. 3) Include the function encode() in the program and call it in the main function. The encode() function assumes that input array is in the array a and computes the encoded numbers and store them in the array b. The function uses the key array key to encode. n represents the size of the array a and b. void encode (int a[], int D[], int key[], int n); 4) The main function calls the encode function, and then displays the outputStep 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