Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Assignment

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 caset'. 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

(INPUT)

A B C 1 H E

L M E

2 0 F 1

=

(OUTPUT)

D E F 1 K

O P

2 0 1

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions