Text To Int
This is a warmup exercise.
It is not compulsory, and may be
completed individually or with your lab partner.
You should make sure you have completed parrot before completing this task.
Copy your parrot.c
file and modify it so that
instead of printing the characters that it reads, it
prints the decimal value of each character on a new line.
Note that the decimal value of the new line character is 10 and that it should be printed out.
Some Examples
abc 97 98 99 10
17 49 55 10
Hello, world! 72 101 108 108 111 44 32 119 111 114 108 100 33 10 17 is my favourite number. 49 55 32 105 115 32 109 121 32 102 97 118 111 117 114 105 116 101 32 110 117 109 98 101 114 46 10
To run some simple automated tests:
$ 1511 autotest textToInt
To run Styl-o-matic:
$ 1511 stylomatic textToInt.c Looks good!
You’ll get advice if you need to make changes to your code.
Submit your work with the give command, like so:
$ give cs1511 wk05_textToInt
Or, if you are working from home, upload the relevant file(s) to the wk05_textToInt activity on Give Online.