1 solutions

  • 0
    @ 2025-11-5 19:00:38

    C++ :

    #include<iostream>
    #include<cstdio>
    using namespace std;
    int main()
    {
    	char c;
    	int letter=0,digit=0,space=0,other=0;
    	while ((c=getchar()) != '\n')
    		if (isalpha(c)) letter++;
    		else if (isalnum(c)) digit++;
    		else if (c==' ') space++;
    		else other++;
    	cout<<letter<<" "<<digit<<" "<<space<<" "<<other<<endl;
    	return 0;
    }
    
    • 1

    C语言程序设计教程(第三版)课后习题6.2

    Information

    ID
    19141
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    (None)
    # Submissions
    0
    Accepted
    0
    Uploaded By