Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write In C Write a program that encodes the input characters using the following algorithm. - if the input character is a digit (' 0
Write In C
Write a program that encodes the input characters using the following algorithm. - if the input character is a digit (' 0 ' through ' 9 '), then output the digit by adding 6 to the digit and calculate the remainder by 10 . For example, if a digit is ' 6 ', then replaced digit is ' 2 '. - Subtract the digit with ' 0 ', add 6 , and then calculate the remainder by 10 , then add ' 0 '. - If the character is an alphabetic letter, then shift the letter by 6 . For example, if the letter is ' B ', then the letter becomes 'H'. - Subtract the letter with 'a' (for lower case) or 'A' (for uppder case), add 6, and then calculate the remainder by 26, then add 'a' (for lower case) or 'A' (for uppder case). For example, ' X ' shifted by 6 is ' D '. - If the character is a white space, skip it. - If the character is not a digit, an alphabetic letter, or a white space, output the underscore '.' character. Requirements 1. Follow the format of the examples below. 2. Use getchar() function to read in the input. Do not use scanf. 3. The user input ends with the user pressing the enter key (a new line character). 4. Character handling library functions in ctype.h are allowed. Examples (your program must follow this format precisely) Example \#1 Enter input: 7+8 3_4 Example \#2 Enter input: usf.edu ay l_kjaStep 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