C primer plus (version 5) programming exercises-Chapter 8 programming exercises, primerplus
1. design a program to count the number of characters from the input to the end of the file.
# Include <stdio. h> int main (void) {int ch; int I; I = 0; while (ch = getchar ())! = EOF) {if (ch! = '\ N') I ++;} printf ("char for count % d", I); return 0 ;}
2. Write a program and read the input as a forward stream until an EOF is encountered. This program prints each input character and its ASCII decimal value. Note that the characters before the space characters in the ASCII sequence are non-printable characters and must be specially processed. If the non-printable characters are line breaks or tabs, Print \ n or \ t respectively. Otherwise, use the control character symbol. For example, if ASCII 1 is Ctrl + A, it can be displayed as ^. Note that the ASCII value of A is Ctrl + A plus 64. Similar to other non-printable characters
222. In addition to a new line starting every time a line break is encountered, each line prints 10 pairs of values.