[Solved] ENCE260 Lab3 to 6 solution

$25

File Name: ENCE260_Lab3_to_6_solution.zip
File Size: 244.92 KB

SKU: [Solved] ENCE260 Lab3 to 6 solution Category: Tag:
5/5 - (1 vote)

[This program builds on the last one]Write a program that loops, reading characters from standard input until EOF occurs. For each character read, a singleline of output should be printed as follows:1. If the character is a new-line character (which has the value 12, i.e. 10 decimal), the printed line should be
(including the quotes). Otherwise 2. The character itself should be printed, enclosed in single quotes followed by a colon and a space, followed byeither:Digit <n> if the character represents one of the digits 0 through 9, where <n> is the represented digit, orLetter <n> if the character is one of the letters a through z or A through Z, in which case <n> is the ordinalvalue of the letter, i.e. 1 for a or A, 2 for b or B etc, orNon-alphanumeric if the character is neither a digit nor a letterNotes:1. You may assume that no non-printing control characters (characters less than 32 decimal) other than newline arepresent in the input. This is to save you worrying about the messed-up output that youd get from characters likeTab (t) and Return (r).2. You will probably want to use various functions from ctype.h, such as isdigit and isalpha.3. Remember that you can do arithmetic on characters so that E D evaluates to 1.4. Since backslash in printf format strings usually has a special meaning (as in
or 12), if you wish to print abackslash you should escape it with another backslash! For example, printf(\Hi!
) prints the string Hi!followed by a newline.For example:Input ResultGo ENCE260!EndG: Letter 7o: Letter 15 : Non-alphanumericE: Letter 5N: Letter 14C: Letter 3E: Letter 52: Digit 26: Digit 60: Digit 0!: Non-alphanumeric
E: Letter 5n: Letter 14d: Letter 4

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] ENCE260 Lab3 to 6 solution[Solved] ENCE260 Lab3 to 6 solution
$25