Question: Write a program test-ascii.cpp that asks the user to input a line of text (which may possibly include spaces). The program should report all characters
Write a program test-ascii.cpp that asks the user to input a line of text (which may possibly include spaces). The program should report all characters from the input line together with their ASCII codes.
Make sure to print exactly one space between the character and its code. ( I need to use getline in this program)
Hint:
When you are printing a value of type char on the screen, it is normally shown as a symbol. To print it as a number (as its ASCII code), type cast it to integer:
cout << (int)c;
Example:
$ ./test-ascii Input: Cat :3 Dog C 67 a 97 t 116 32 : 58 3 51 32 D 68 o 111 g 103
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
