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

Sampile input:

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

Sample output:

digit:10
alphabet:26
other:13
[Exercise] Coding (C) - asked in 作業 by (18k points)
ID: 17667 - Available when: Unlimited - Due to: Unlimited

recategorized by | 3.3k views
0 0
Called for Help

65 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <ctype.h>

#include <stdlib.h>

int main()

{

    char c;

    int i=0,j=0,k=0;
** * * ** * * * ** ** ** * **** * ** *
* * ** * * * * *** * * ** *

    {
*** * * * *** * ** ** **** * * ** *** ******* ***
* ** ***** *** * * *** ** *** ** ** ** * * * ** ** ** * * *** * * * * ** ****** *
* ** ** * *** ** * **** ** *** ** ** ** **** ** **
**** *********** * *** * ******* * ** * * **** ** * *
* ** ***** * * ** ** * * *** * * * *** ** **** * * * ***
* ** * * ******* * *** ** ** * * * * ** ** * ** **
** * * ** * * * * * ** *** *** * ** ** * * ** ** * * *** * * * ** *** * ** * * * **** * *** **

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

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

#include<stdlib.h>

#include<ctype.h>

int main()

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

    int x=0,y=0,z=0;
*** * ** * ** ***** **** ** * * *
** * ** * * ** * * *** != '\n')

    {
* ** * ** * * * * *** * ******* ** ** ** ** *
* * * * ** * ** * * * * * * **** * ******* * ** ***
*** **** * ** ** * * ******* ***
** * * ** *** **** * * ** ** * **** **** *
*** ** * * ** *** ** * ** * ** * * * * * ** ******
** ** ** **** ** * * ** ** * * * ** **
** * *** *** ** * * * * ** **** *
* ** ** * *** * *** * * ** * * ** ** ** ****** ****** * * **
******* * *** * * ** * * ****** * * * * ** ***

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

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

#include <ctype.h>

#include <stdlib.h>

int main()

{

    char c;

    int i=0,j=0,k=0;
** ** *** **** * *** * *** * * * ***
***** **** *** ** * **** * *

    {
** ** * ***** * * ** *** *** ** ** *** ** ** * * **
** ** * * * * ** * * * * * ** * * * * ** * ** * *** * * ** *
* ** * * ** ** ** ** *** ** * *** ** * **
* * * * ***** * ** * *** *** * *** *****
* ** *** * * * * * ** * ** * ** * **** * *
* *** * *** * ******* ** ** ** * ** ** *** * *
* **** * ** ** * ** * ** * * ** * * ** ******* *** ** * ** * *** ****** * ** ** * *

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

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

#include <ctype.h>

int main()

{

    char c;

    int i=0,j=0,k=0;
* * *** * *** ** * ** **** ** *** * * *
* *** ** * ** ***** * * ** ***

    {
** * * ****** * ** * ** * **** ** * * * ***** ** * ** *
* *** * *** ** *** * * *** * * * * ** * ** **** ** ** * *** ** * ** *** * * *
**** * ** ** ** * * * ****** ** ** * *** **** *
** * * ********* ** ** *** * **** * ** * *
** * ** * ***** ***** * * * *** ***** * *
* * ** *** ** ** * ** * * ** *** ** ******* **** ******
* * * * ** * * * * ** **** * * * * * *** * * * * **** *** * * * ***** ** * * ** * * * ** *** **

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

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

#include<stdlib.h>

#include<ctype.h>





int main ( void )

{
* * * ** * ** * * c ;
**** **** ****** *  digit=0,alphabet=0,other=0;
***** * ***** * ** * * * * * **
** * * ** *** ** **** **** != '\n')
* * * **** ** * * ***
**** ** * ** * **** **
* * *** *** * * * *** * (isalpha(c))
* * * * * ** *** * **** * * * ** * *
*** * ****** ** ** * * *******
* *** * * ** * ** ** * * ** * * if(isdigit(c))
* * ***** * * *** * **** * * *
** ***** * * * *******
** *** * * ** ** *** * ** ** *  
* ** ***** *** ** ** * **** *****
**** ** ****** *
** * * * * ** **** ***** * ** ** *** * * ** ** ***** * * *** *
** ** * * ** *** **** *** *** ** ** * ******
* ** **** * ** *
*** * * *** *** * *
* * ** ** * **** *** ( "digit:%d\n",digit);
* *** **** ****** * * * ( * * * ** * *
* **** *** *** ** *** ** ** * ( "other:%d\n",other);
* ** **** * ** * *** ***** * * *** **** * * * * *
* ** * ** * * * * *** * * ****** 0;

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

#include <ctype.h>



int main(void)

{

   int a=0,b=0,c=0;

   char d;
* * ******** * *** * ** ** ** * * * *
*** ** * * *** **
** * * * ** ** * * ***** ** * ** ** **
*** ***** * ** * *** * ******* * * * ** **** (isdigit(d))
* * ** ** ** * *** * * * * ***** * * ** ** * ** * *
*** ***** *** * * * ** * **** (isalpha(d))
* *** ** **** ** ***** * *** * * * * * *** **** * ********** *
** ***** ***** *** * * ** * *** * * * * * * ****
***** ** * ** *** * ** * * ***** * ** * **
* * * * * * ** ** ** * ** **
** * ** * ** ** ** * ** ** ** ** * * *
** * * * * **** * * ** ** ** *** ***
* * * * *** ********* * * *** * *** *
* * * *** * * **** ** ** * ***

return 0;

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

int main()

{

    char c;

    int i=0,j=0,k=0;
* ***** * * * **** * * * ** * * **** * **
* ** ***** * ** * * ** * * **

    {
** *** * * **** * ** * ** * * * * ******
** * ** * ***** * *** *** * * ** ****** * ** * ** * ***** * * **** ***** * ******
** **** *** ** ***** * * ***** **** * *** * * ** * *
****** *** * **** ***** * * * **** ** * * **
** ** * ** * ***** *** * ******** *** ** ** ** * * ** *
* *** * ** * ***** * ** ** * ** ** **** ** *
** * ** ***** ** ***** **** *** ** ** * * * **** * * * * * ** * ** * ** ** ** ** ** *** **** *

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

    return 0;

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

#include<stdlib.h>

#include<ctype.h>

  



  int main ()

   {

     char c;

     int a=0,o=0,n=0,h=0;
*** * *** *** * * ** * * ** * * * ** *****
*** ** *** * ** * * *** ***** * *** *
** *** * * * ** * ** * ** ******* * * *
* * ** *** ** * ** * ******** * * ** * **** **** * ***
** * **** * * ** ****** **** ** *** ** *** * * * ******
***** * * ** ** * * *** * ** * * * * * *** if(isdigit(c))
** ** * ** * *** ** * * ***** * *** ** * *** **** * *** * * * *
*** ** ** * ** * ** * *** ** * ** ** * ***** ** *

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

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

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

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

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

#include<stdlib.h>

#include<ctype.h>

int main()

{

    int i=0,j=0,k=-1;

    char c;
* ** * * * * **** * *

    

    {
** *** ** *** * * ** **** * * * ** * ****** *** ** * * * * ***** * * * *** * ****** **** * * * ** * ** ** **** *
* * ***** ** * * * ** * ** *** *** * * ********* ** * * * * ************* ** * ****** *** * *** ** * * ****
* * *** ** * ** * *** **** * ** * ** * * * ** ** * ** *** * * * * * * * **** * * ***
* * **** * *** * ** **** * *** ** *** * * *** * ** ******** * ******* * ******* * * ** **** *** *** if(isalpha(c))
**** *** ** * * * * ****** **** ** * ** * ** **** * * *** *** * * * ********** ***** *** ** * * * *
* *** *** * * * ** **** ** * *** * ** *** *** ** * ******* ** * ***** * * * * * * * * * ** if(isspace(c))
** * * * ** *** * ** * ***** * * * * * * ****** * * *** ** ** * ** * * ** ** * * * *
*** * *** * * ** **** ******* * ** * ***** **** * * *** * * * * ** * * * ** ** * * ** ** * ** ** * * * ** *** if(ispunct(c))
* ** ** ** *** ** **** * * * ** ** *** ** ** * ***** * ** * * **** * ** ** *** **
*** * ** *** * * *** * **** ** *** * ** * * * ** ***** ** ** * ** **** * ** ****** *** ** if(iscntrl(c))
**** ** * * * * * *** * * * * * * ****** ***** ***** * ** ** * * * * *** ****** * * * * *

    }

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

    

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

    return 0;



}
answered by (122 points)
0 like 0 dislike
Hidden content!
#include <stdlib.h>

#include <ctype.h>



int main(void)

{

   int a=0,b=0,c=0;

   char d;
* * * **** * * * ** ** ** * **
* * * *** * *** * * *
* * * ** **** ** ** ****
* * ** *** ** * * * ** * *** * ** (isdigit(d))
*** ** ** * **** *** ** ** * * * ** * ** * * *** **** * *
** *** * * *** * ** * * * (isalpha(d))
******** ** * ****** * **** * * * * * *
*** ** ***** * ** ** * * * ** *** ** * **** *** *
* * * * * * ****** ** * ****** * *** *
****** * * * ** * ** * ** * **
**** * * ** *** ** * ******** *** ***
* *** *** * ** *** * ** * ***
* **** * **** * * * * ** * *** ** * *
* ** * * * * * * ** * * * * * *

return 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.130.33
©2016-2025

Related questions

0 like 0 dislike
23 answers
[Exercise] Essay (Open question) - asked Dec 22, 2016 in 作業 by Shun-Po (18k points)
ID: 19793 - Available when: Unlimited - Due to: Unlimited
| 1.5k views
0 like 0 dislike
20 answers
[Exercise] Essay (Open question) - asked Nov 10, 2016 in 作業 by Shun-Po (18k points)
ID: 17220 - Available when: Unlimited - Due to: Unlimited
| 1.4k views
0 like 0 dislike
7 answers
[Exercise] Essay (Open question) - asked Dec 22, 2016 in 作業 by Shun-Po (18k points)
ID: 19794 - Available when: Unlimited - Due to: Unlimited
| 721 views
0 like 0 dislike
26 answers
[Exercise] Coding (C) - asked Nov 3, 2016 in 作業 by Shun-Po (18k points)
ID: 16957 - Available when: Unlimited - Due to: Unlimited
| 1.6k views
0 like 0 dislike
37 answers
[Exercise] Coding (C) - asked Oct 20, 2016 in 作業 by Shun-Po (18k points)
ID: 14579 - Available when: Unlimited - Due to: Unlimited
| 2.2k views
12,783 questions
183,443 answers
172,219 comments
4,824 users