Answered step by step
Verified Expert Solution
Question
1 Approved Answer
o Prompt the user to enter a character. Use the text Please enter a char value followed by a single colon, and nothing else (ei
o Prompt the user to enter a character. Use the text "Please enter a char value" followed by a single colon, and nothing else (ei ther visible or invisible). The message should appear on a 1ine by itself. o Fetch a character code from standard input, and save it in a variable of a suitable numeric data type o Provide feedback by sending (to standard output) a message which reports that the input has been received. Your message should take the form "The character code of 'x' is Y," where X is replaced by the character read earlier, and Y i s replaced by the numeric value of the character. The message should be followed by a single linefeed symbol, and nothing else (either visible or invisible) . Hint: a character is by definition an integer code. Formatting with %c will cause a symbol to be generated. Formatting the same value wi th another specifier (which you can figure out by reading the documentation for printf) will produce a numeric value Notes The results produced by this program 1look similar to the following image. Your version of the question may request different prompt and feedback strings, so make sure you display the requested message rather than simply copying from the image. bash $./echo char code.exe Please enter a single character: The character code of "A' is 65 $./echo char code.exe Please enter a single character: The character code of "a is 97 $./echo char code.exe Please enter a single character: The character code of "b' is 98 $./echo_char_code.exe Please enter a single character: The character code of c is 99 $./echo char code.exe Please enter a single character: The character code of . z' is 122 Sbc void echo_char_codeO / Insert your solution here Use this test driver to implement and test your function prior to submission #include void echo_char_code O // Insert your solution here. int main) [ echo_char code); return 0 AMS wi11 run your program several times with different characters selected randomly from the ASCII character set. Tests will include normal characters, and special characters such as TAB, CARRIAGE RETURN, and LINE FEED. The test harness will show the ASCII code of the input data which your program is tested wi th, along with the expected and actual values obtained by running the program. AMS uses input redirection to send character data to your program, so if there is an error the input sequence will not show in the Expected and Actual parts of the error report. This is expected processing
Step 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