0 like 0 dislike
8.3k 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
| 8.3k views
1 3
Called for Help

82 Answers

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)
0 like 0 dislike
Hidden content!
* ** ** * * * *

#include ** * ** * *

int main (void)

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


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

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




* * * * * 0;





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



int check ( char c)
* **
* ** * * int i=0;
*** * ** *

* * ** * *** * if ( ** (c))
** * * * ** * * * *** *

* * ***** * * * ***** i++;
* ** * * * *** *****

**** ** * * * ** ** **** return i;
** * * * ** * ** * **


***


* * ******** * * * c)

{


*** * * * int t=0;


*** * * *** if ( (c))
*** * *** ** * * * * *** *

***** ** ******* * *** * * * t;
** * * * * * *

** * * *** * * else if ( * (c))
** ** *

*** * * **** * ** *** * t++;
*** * * * ** *

* * * ** * *** ** **** * ** return t;
* * ** * ** * * * ** *

}


**** * * ** int ** * c)

{
*** * *** **

******** * * int j=0;
** ** * * *

* ** * *** if ( * (c))
* * ** * * * ** * ** ** *

* * ** * ** *** * j;
* * * *** *** ***

* * * else if ( isdigit (c))
* * ** *

***** ** * j;
** ** * * *** ** ** **

*** * * else



*** * * * *** * ** * j++;


** * * ** ****** * ** return j;

}



int main ()
* *** *


* * **** c;
** ** *
* * * *** * * * *
** ** **
** * * * * * * ** ** * ***
**
* ** ( c != '\n')
** *
** **** **


* * *** (c);
** * *
* ** * * **
***
**** **** ** *


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

}


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


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

#include<ctype.h>

int main(void)

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

    int digit=0,alphabet=0,other=0;
* **** ***** * * * * *** ** **** * *** *
*** *** * * * * * ** != '\n')

    {
* ** ** **** ***** * * * * * * * * ** ** *** * * *
* * * * ** * * * * * * * * * ** * *** *** * * *** *** ** * * = alphabet+1;
**** *** * * ** ** **** ******** *** * * ***** * ***
** * * * **** * ** * * ** * * * ** ** * * ** ** ***** *** * * = digit+1;
***** ** ** * ** ** **** * * ** * **** ** ** ***
* * * *** * ** * * * *** ** * *** ** *** * * * * ******* *** * = other+1;


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



    }
* ** * * ** * ** **** *** * * ** * * *
*** ** * * *** ** **** ** * * * * *** ** * **
* *** ******* *********** *** *** * * * * **
*** * **** * * ** *** * 0;

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

#include<ctype.h>



int check (char c)

{




** ** * * * *** ( isalpha ( c ))
* * * ***** ** * ** ***** ** ***** * **** * * * 1;




** *** ***** * * ** * ** ( isdigit ( c ))
* ** ** * *** * *** * * *** ** ** *** 2;




** **** *** ** ** * *
*** * ** * ** ** *** * * * ** ** *** * *** ** * * 3;





 }

int main ( void )



{


* ** *** ** * * c;

 int n1=0, n2=0, n3=0;
* * *** ** ** * * * * ****** ** ** ** *** * !=EOF)


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

   {
* * ** * * * ** * 1:
*** * * * * * * * ** * ** * ******** ***** * *
******* ** **** * * * * * *** *** * * **
* *** ****** * ** ** * * * 2:
* ** ** * ** * * **** *** * * * * ** *
*** ** * ** * * * * * *** *** **********
****** * * * ** * *** **** * 3:
* * * **** * * ** ** * **** ** *
** * ** ** ** **** ***** * ***** ** * ** ***

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


** * * *** ** 0;



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

#include * ** * *

int main(void)

{
* **** * *** a = 0, b = 0,i = 0;
*** ** * *** * c;
* ** ** * * ** *** *** ** * *
** ***** ***** * != '\n')
* **** **** **
*** * * * ** * ** ( isalpha (c))
* * ***** * * ** ** * *********** * += 1;
* * ** ** * *** if ( isdigit (c))
* ** * ** * * *** * ** * ***** += 1;
* **** ** *** i += 1;
*** ** * **** * * **** * *

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


** * ** * 0;
*** * **
answered by (102 points)
0 like 0 dislike
Hidden content!
* * ****** ** *


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


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




** ( ** )

* * *




** * a = ** = * = ** = *




* * *** * * * ** * ** **
* * * )

* ( * ( c ** * ;
* ( *** ( c * * *** ;
* ( * ( c * **** ;
* ** *** *** * ** * *
*






= d a - *
** ** * * * *** * ***
* * *** * ** ** ** * * ***
*** ** * * * * *** ****
***




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



void check(char c, int *i, int *j, int *k);



int main(void)

{
* *** ** **** * ** c;
** * * ** * **** **** *** num1 = 0,num2 = 0,num3 = 0;
*** *** ** *** * * * *** ** * * ** * * *
* * * ***** * ** * * (c != '\n'){
* *** * * * * * * * *** * * * * **** *** * &num1, &num2,&num3);
** * **** * * * * * ** * ** * * * *** ** ** * * **** *** * * * ***
** *** * ****** * ** *
**** ****** * * *** *** ** **** * * *** * *
*** ** * * * * * * * * * ***** ***** * *
** * ** * * *** * **** * ** * * ** * ** ***** **



 return 0;

}



void check(char c, int *i, int *j, int *k)

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



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


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


* *** ** ** ***




( )
*
* * * *




** a = *** = ** = = **




** ** **** *** ** *******
* * * * * )
**
* ( ** ( c *** * * ;
( ** * * ( c * * ;
( ** ** ( c * ;
* * ** *** * ** ** *
*






* = d a -
*** * **** * * *
* * *** * * * ** * **** ** *
* ** ** ** *** ***** * * *
** *




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

#include * * * ***

int main(void)

{
* ** * *** * * a = 0, b = 0,i = 0;
*** * * *** c;
* ** ** **** * ******* * * **
********* * * * *** != '\n')
** *
** ** * ** ( isalpha (c))
*** * * *** **** ** **** += 1;
** *** * * * *** * if ( isdigit (c))
** **** * * *** ** += 1;
* ** * i += 1;
** ** * **** * ** * ** ***

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


** * * * * *** 0;
** ** ** **
answered by (102 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.127.115
©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
| 541 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.8k 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
| 3.5k 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
| 577 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
| 874 views
12,783 questions
183,442 answers
172,219 comments
4,824 users