C primer plus (version 5) programming exercises-Chapter 8 programming exercises, primerplus

Source: Internet
Author: User
Tags printable characters

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.