0 like 0 dislike
6.2k views
請撰寫一個程式,使用者會輸入一行字元,換行字元代表輸入結束,請計算所有的輸入當中有多少個英文字母,多少個數字,以及多少個其他的字元,並依照範例的格數輸出。

Sampile input:

1234567890ancdefghijklmnopqrstuvwxyz~!@#$%^&*()_+

Sample output:

digit:10
alphabet:26
other:13
[Exercise] Coding (C) - asked in 作業 by (18k points)
ID: 17578 - Available when: Unlimited - Due to: Unlimited
| 6.2k views
1 3
Called for Help

82 Answers

0 like 0 dislike
Hidden content!
** ***** *** *** **

# * * ** * **

int * ** * *

{

int *****
** c;
* ** * * ** *** * * *
*** *

{

if ( * ( c ))

i += 1;
* if ( * * ( c ))

j+= 1;
**
* *
* ** ** * * ** *

}
* * *** **** * * **
** ** **** ** ** * * **
** ***** **** *

}
answered by (-383 points)
0 like 0 dislike
Hidden content!
* * * * * **** *

# *** * * .h ***
****

{

int * *
* ** c;
*** * * ** ** *** *
* * *

{

if ( * ( c ))

i += 1;
if ( ** ( c ))

j+= 1;
* **
***
** * ***** *** *** ***** *

}
**** *** * ****** *** *
* * * ** ** ** *
***** * *** **** * * *

}
answered by (-383 points)
0 like 0 dislike
Hidden content!
** * * ** **

# ** ** * * * .h **



int ** *

{
*** **** *
* c;
* ** * * ** * * **
*** * **

{

if ( ** * ( c ))

i += 1;
* if ( * * ( c ))
* * 1;
**
**
***** ** *** * *** * **

}
*** ** * ****** ***
*** * *** * * ** ** ** ** *
* ** * **** *

}
answered by (-383 points)
0 like 0 dislike
Hidden content!
#include *** * * * **

#include ** * *




* * *** main(void){
* * ch , digit = 0 , alphabet = 0 , other = 0;
* ***
**** *** ***** * * ** * * = getchar();
* ** *** ** * *** ** * **** * ** * ** == 0 * ** **** ch != '\n' ** * ** * ** ispunct(ch) != 16 *** * * * ** ** != 8)
****** *** ** ** * * * * * ** ** ** ** * * * * ++;
***** * * ***** * **** * * *** ** * ** ** * == 2)
**** *** ** * * ********** *** * *** * ++;
* * * * * ** ** **** ** *** ** ** if( *** * == 16 || * == 8 *** ** * * ch != '\n')
* ***** * ** * * * * *** *** * *** ++;
* ** *** ch!='\n');


** * * * * * * **** * * ** ***** digit);
******* ** ** * ****** ** * ** * * * alphabet);
* * * ** *** *** * * * ***** * ** * other);
*** *
answered by (-122 points)
0 like 0 dislike
Hidden content!
#include ** * * *** *
* * * *** **




*** * * ** *
** ** ch , digit = 0 , alphabet = 0 , other = 0;
** ** **
* * * ** ** ** * **** **** ** ** *** * = getchar();
** * ** * ***** *** * * * * * * * * * == 0 ** ** * * ch != '\n' ****** * ispunct(ch) != 16 *** ** ** * * * * != 8)
***** ** ** ** ** * * ** ** * * ++;
* * ** * ***** * ** * * * * ** * == 2)
* * * *** * *** * *** * * *** * ** * * ++;
** ** ** ** * **** ** ** ** if( ispunct(ch) == 16 || * * * == 8 ** ch != '\n')
***** ** * ** * *** * ** * ** ** * ** * ++;
* *** *** ch!='\n');


* * ** ** * * * * ** ** **** ** = **** ** digit);
** * ** ***** * ** ******** * *** ** = **** **** * alphabet);
* * * ** * ** ** *** * ** * = * *** other);
* * * **
answered by (-122 points)
0 like 0 dislike
Hidden content!
#include **
*** * * ****** *** **




***** * main(void){
**** ch , digit = 0 , alphabet = 0 , other = 0;
***
** * * ** ** * **** * * ** ***** * ** = getchar();


* * ** ** * * ** *** * * * * * isalpha(ch) == 0 * ** ch != '\n' * ** ** * * ispunct(ch) != 16 *** ** * **** != 8)
** * ***** * ***** ** ** * * * * * * ++;
*** ** ** * * * ***** * ** *** *** * *** * * == 2)
* ** ** **** ***** * * ** * *** * * ** ++;
* *** * * ** ** ** ***** ** *** * if( * * ** == 16)
*** * **** ** * ** ** *** ***** *** * **** ++;
* ** * ch!='\n');


***** * * * *** ** * ** ** = *** *** digit);
* *** *** ** * **** * * * ** **** ** = * * ** alphabet);
** ***** ** * *** * * * = * * other);
***** ****
answered by (-122 points)
0 like 0 dislike
Hidden content!
#include <stdlib.h>

#include <ctype.h>

#include <stdio.h>





int main ()

{
* ***** * *** * * * * ** d = 0  , a = 0,o = 0 ;
**** * * ** ** *** c ;
* * * ** **** ******** * * **** ** * , &c );
*** * * * c != '\n')
* * ** * *** * * *
* ** *** ** ** *** * **** **** * * * * * * * * *
**** **** *** **** * *** ****** * * *** * * * * ** *** = d + 1 ;
* * * ** * *** *** ** *** ******* * * ** ** if (isalpha(c))
* ** * *** * * **** ** ** ** * *** * ** *** = a + 1 ;
* * * *** * * * * * ** ** * * * * * * * * **
** * * * * ** ** ** * ** * *** * ** * * ** = o +1 ;
* * ** * * * * ***** * *** ** *** *** ** * * * ** * , &c );
* ******** * * * * ** *


*** ** ****** * * d );
* * * * * * * ** * , a );
**** ** **** * ** ** * * o );




** * * ** * * * ** 0 ;

}
answered by (-87 points)
0 like 0 dislike
Hidden content!
**** * * * ** *

#include **** *****

int main (void)

{
** *** * c;
** * * i,j,k;


*** * ** *** * * * *
* **** * c!= '\n')
** ** *
* ** **** ( isdigit (c))
* * * * * *
* ( isalpha (c))
*** * *** *
**** * ( ispunct (c))
** * * *** ** *
**** * ***** * **** **** * *** ** *
*** *
** ** * * * * ** * ****
**** * ** ** ** *
** ** *** * *** * * ******




** * * * * ** 0;





}
answered by (-124 points)
0 like 0 dislike
Hidden content!
** ***** ***
* ** ***

** **** **
*** *






* ***** * * * * * * * * ********


*** ***
*


* ( ** * ( c *




+= *


** * ( * ( c


*** *




***
****


** * ***** * ** ** * *
*






***** *** ** ****
** * ** *** * * *
* ****** * ** * * ** *












answered by (-383 points)
0 like 0 dislike
Hidden content!
# include <stdio.h>

# include <ctype.h>

int main()

{

    int a=0,s=0,d=0;
**** ** * *** ** * * c;
* ** ** *** * * **** *** * * * * * ** *
* **** ** * * * ** * *

    {
* ** * *** * * * * *** ** * *** * * ** (isdigit(c))
* * ** * * * ** * ** * ** **** ** * ***** * * ***** *** * * *
* **** ** * ***** ** * * * **** ** ** * * ** * if (isalpha(c))
* * * * ** * ** * * ** * **** ***** ** * * *** ****** *
*** ********* *** ** *** * * *** * ** ** * * *
** ** *** * * * *** * * ** * ** * * * ** ***** * * ***
**** *** * ***** * * * **** ** *** * **** * * *** ** * ** ** *

    }
**** **** ***** **** ** ** ** *
* ** ****** * ** * * * **** * *** * *** ** *
* *** * ******** **** * **** * ** * * * * ***


* *** ** * * ** **** * * 0;

}
answered by (-158 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.255.141
©2016-2025

Related questions

0 like 0 dislike
0 answers
[Exercise] Essay (Open question) - asked Dec 28, 2016 in 作業 by Shun-Po (18k points)
ID: 20139 - Available when: Unlimited - Due to: Unlimited
| 436 views
0 like 0 dislike
20 answers
[Exercise] Essay (Open question) - asked Dec 21, 2016 in 作業 by Shun-Po (18k points)
ID: 19748 - Available when: Unlimited - Due to: Unlimited
| 2.1k views
0 like 0 dislike
26 answers
[Exercise] Essay (Open question) - asked Nov 9, 2016 in 作業 by Shun-Po (18k points)
ID: 17203 - Available when: Unlimited - Due to: Unlimited
| 2.7k views
0 like 0 dislike
0 answers
[Exercise] Essay (Open question) - asked Dec 28, 2016 in 作業 by Shun-Po (18k points)
ID: 20140 - Available when: Unlimited - Due to: Unlimited
| 472 views
0 like 0 dislike
3 answers
[Exercise] Essay (Open question) - asked Dec 21, 2016 in 作業 by Shun-Po (18k points)
ID: 19755 - Available when: Unlimited - Due to: Unlimited
| 681 views
12,783 questions
183,442 answers
172,219 comments
4,824 users