1012:c Language Programming Tutorial (third Edition) after class exercise 6.2

Source: Internet
Author: User

Title Description Enter a line of characters, respectively, the number of letters, numbers, spaces and other characters. Input line character output statistic sample input
aklsjflj123 sadf918u324 asdf91u32oasdf/. '; 123
Sample output
23 16 2 4

1#include"stdio.h"2 3 intMainintargcChar Const*argv[])4 {5     Chars[Bayi];6     intI, Char_count =0, Num_count =0, Space_count =0, Other_count =0;7     //scanf ("%s", s);8 gets (s);9 Ten      for(i =0; S[i]! =' /'; i++) One     { A         if(S[i] >='A'&& S[i] <='Z'|| S[i] >='a'&& S[i] <='Z') -Char_count + +; -         Else if(S[i] >='0'&& S[i] <='9') theNum_count + +; -         Else if(S[i] = =' ') -Space_count + +; -         Else +Other_count + +; -     } +  Aprintf"%d %d%d%d\n", Char_count, Num_count, Space_count, other_count); at     return 0; -}

1012:c Language Programming Tutorial (third Edition) after class exercise 6.2

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.