Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that reads rows of chars, calculates the total shift amount, shifts all letters within these rows of chars to the right, and

image text in transcribed

Write a program that reads rows of chars, calculates the total shift amount, shifts all letters within these rows of chars to the right, and finally prints out the new version of the rows of chars to the screen. First, the program will read rows of chars where each row is terminated by the 'E' value, and the final row is terminated by the 'T' value. These rows of chars will be kept in a dynamically allocated 2D char array. Next, a function (calculateShiftAmount) will get the whole 2D array, calculates the summation of the digit values in the 2D array, and return it as an int value. This value will represent the total shift amount (totalShiftAmount). Finally, another function will get individual elements of the 2D array and shifts it to the right according to the English alphabet by this totalShiftAmount value and put the shifted value back into the correct space. While shifting consider the English alphabet to wrap around itself (i.e., if you shift 'Z' by 2 to the right, you get a 'B'). This process MUST be done by using a void function by sending the appropriate cell of the 2D array with a call-by-reference fashion. Finally, the corrected 2D array will be printed out to the screen. NOTE: The whole array MUST be read into and kept in a dynamically allocated array using the malloc, calloc, realloc, free functions. NOTE: The elements of the array can either be a lower case letter, an upper case letter, or a digit. Nothing else. Do not need to check this. NOTE: The end-of-row character is only the uppercase 'E', NOT the lower case 'e'. Similarly, the end-of-input character is only the uppercase 'T', NOT the lower case 't'. NOTE: Calculation of the total shift value MUST be done in the first function. Shifting a char MUST be done in the second function with a call- by-reference fashion to the relevant cell of the 2D array. Every other functionality MUST be done in the main function. ABC1 -75RKE Input LME g/21tE 0 og eu E -1 T DdE 20FT O ABCT DEF1K h K2 mu -75 P! Output OP 00hfv Bb 201 -15 OYZ a Write a program that reads rows of chars, calculates the total shift amount, shifts all letters within these rows of chars to the right, and finally prints out the new version of the rows of chars to the screen. First, the program will read rows of chars where each row is terminated by the 'E' value, and the final row is terminated by the 'T' value. These rows of chars will be kept in a dynamically allocated 2D char array. Next, a function (calculateShiftAmount) will get the whole 2D array, calculates the summation of the digit values in the 2D array, and return it as an int value. This value will represent the total shift amount (totalShiftAmount). Finally, another function will get individual elements of the 2D array and shifts it to the right according to the English alphabet by this totalShiftAmount value and put the shifted value back into the correct space. While shifting consider the English alphabet to wrap around itself (i.e., if you shift 'Z' by 2 to the right, you get a 'B'). This process MUST be done by using a void function by sending the appropriate cell of the 2D array with a call-by-reference fashion. Finally, the corrected 2D array will be printed out to the screen. NOTE: The whole array MUST be read into and kept in a dynamically allocated array using the malloc, calloc, realloc, free functions. NOTE: The elements of the array can either be a lower case letter, an upper case letter, or a digit. Nothing else. Do not need to check this. NOTE: The end-of-row character is only the uppercase 'E', NOT the lower case 'e'. Similarly, the end-of-input character is only the uppercase 'T', NOT the lower case 't'. NOTE: Calculation of the total shift value MUST be done in the first function. Shifting a char MUST be done in the second function with a call- by-reference fashion to the relevant cell of the 2D array. Every other functionality MUST be done in the main function. ABC1 -75RKE Input LME g/21tE 0 og eu E -1 T DdE 20FT O ABCT DEF1K h K2 mu -75 P! Output OP 00hfv Bb 201 -15 OYZ a

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago