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

82 Answers

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

# include <ctype.h>

void check ( char c);

int main ( void )

    {
* * * * ** ***** **** ** * *** ** * **** * ** **** *** digit, alphabet ,other;
* **** * * * ***** **** ** * ** * c;
****** * ** ** ** ***** *** ** ** * ("%c", &c);
** *** ** * ** *** **** * *** * * *** *** * * (c != '\n')
**** * *** *** **** * * ** **** * ** *** ** * ** ** *
**** * * * ** *** ** * * * ** * ** * ** ** * ** * * * *** * * * * * ("%c", &c);
***** * ************* *** * *** * * **** ** *** * * * ****** * ** * ** * *** (c);
*** * ******** ******* ** ** ** * ** ** * * ****
***** * **** *** *** ** ****** * ** * ** * * ** * ** ** ***** * * * ********* ****
** ** ** ** * * *



void check ( char c)

    {
** ** * * * * ****** * **** * * * ***** digit=0, alphabet=0 ,other=0;
* * ** * * * * *** *** ** * * *** * *** ** * ( isalpha (c))
* *** * * * *** * * ** * * * * ** * * * ** * * ** * ** ** * ** *
*** * * * ** ** * ** * ** * * * * ** * **** ( isdigit (c))
* * * * *** *** ** ** **** ** * ***** * * * * ** * **** * ** ** * * * **
* ** ** * * ** ** *** * * **** ( isspace (c))
*** * * ** * * * * * ***** * *** **** **** * *** *** **** ** **
* *** * * ****** * **** * * ** **** * * ( ispunct (c))
* ** ********** ** * * ***** *** ** * **** * **** * ******* * ** *
* *** ** * * ** * * * ** * * * * *** * * ** *

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

# include ******* * ***

int i,j,k;  

void check (char c);

int main ()

{

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

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

}

void check (char c)

{
* * * ** **** (isdigit(c))
*** * * ** * ** ** *
* ** **** * ** * * (isalpha(c))
** * * ** * *
**** **** * *** * (isspace(c))
** ****** **** * ** ** *

* * *** ** * * (ispunct(c))
* * * ** *** ** **

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

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

#include * ** * *

#include * * *

#include * * * * **



int check ( char c)

 {
** * * **** ** * ********* i=0;
* * * ** ***** * **
** * ** * * * *** * ( isalpha (c))
* * * **** ** * ***** * ** *** ** * **
* * ** * ** * * **** *** * * ****** * * *** **
* * ** *** * *** * * * * *** ** *
****** *** * ** ** * *** * * ** * ** * ** * * i;
** * ** ** ** * * * * * ** * ***********

 }

 



 int check1(char c)

{


* ****** ** *** * * ** t=0;


* ** * **** * * * **** * * ** * ( isalpha (c))
* ** * * ** ** * **** ** *** **** **** *****
* * * * *** **** * *** *** * *** ***** ** *** * ***
* ** **** * *** * * *** ** * * * **
* ** **** * ******* * * * ** if ( isdigit (c))
****** * * ***** * *
*** * * * * * *** *** ** *** * ** ***
** ** *** *** * *** * * * ** * *
* * * * * * ******* * * * *** ** * * *** * t;
* *** ** ** *** * ** **** ** * *** ** ** **

}


* ** ********* *** * check2(char c)

{
* ** ** * ****** *
** ** * * *** ** * * * j=0;
* * *** **** **** ** * * *
**** ** * **** ** * * ( isalpha (c))
* * * **** * * ***** ** * * **** * * *
** ** * * * ** * * ** * * *** * **** ** *** *
* * ** ** * * * ** ** * ** ** ** * ***
* *** * ***** **** ****** * if ( isdigit (c))
** ** ******* * * ** *
**** *** * ** * **** ** * * ** ** * * * *
** **** ** * * * ** ** * * *** * * * * * **
* * ** * ** *



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


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

}



int main ()

 {


* * ** * c;

 

 int i=0,j=0,t=0;
* * * **
*** * * * ** * * &c);

 

 while ( c != '\n')

 {



 i +=check (c);

 

 t +=check1(c);

 

 j +=check2(c);



 scanf **** *** **** * &c);

 

}


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


*** * * ** 0;

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

#include<stdlib.h>

#include<ctype.h>

int main()

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

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

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

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

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

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

#include<stdlib.h>

#include<ctype.h>

int main()

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

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

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

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

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

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

#include<stdlib.h>

#include<ctype.h>

int main()

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

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

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

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

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

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

#include <stdlib.h>



int main()

{

    char a[100];

    int q=0,w=0,e=0,n=0;
* ** * **** * * * * **
**** * * ** * *** ***** * (a[n]!='\0')

    {
* ** ** ** ** * * * *** * ** * *** * * * * ** * *** ** ** ** ** *
* ***** *** * * * ** * * *** **** ** * ** ** * *** * *** *
** ** *** * ** * * ** *** ** * * **** *** ***** *** * *** * ** ** * * ****
** * ** ** * **** ** *** * ** ** * * * * ** * ** * * * ****
* ** * * * * ** **** *********** * *** ******* ** if ** * **** * *** *** * * * ******
* * * **** **** ** ** * * * * * * * * * *** * ** **** ** ***** *
***** * ** * * **** ** * * * * * ** *
*** * *** * * * ** * ** ** ** * * * ** * ****** **** ***** ****
* ***** ** ** * * * * **** * * * * * **** *

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

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

#include <stdlib.h>



int main()

{

    char a[100];

    int q=0,w=0,e=0,n=0;
*** ** * ** ** * ** * ** *** * **
** ******* * * **** * (a[n]!='\0')

    {
** *** ****** * *** * ****** ** * ** * * * * * ** ** ***** *** * *
*** ** * ***** * * *** ****** *** ** ****** ** **** * * * *** *** *** ** ** ***
* **** * * ** * **** ** * **** ** *** ** * * *** ** * * ** ** *
* ***** * * *** * * *** * * * *** **** *** ** ** ***
** * * **** * *** * * ** *** * ** *** * if **** ****** *** * **** *
* **** * * ** * ****** * * * * ** ** * * *** ** ** ***** *** * ** *
* *** **** ** ****** ** *** * ** * * **
** * * * *** *** **** ** ** * **** * * * ** * * * ** * * ** *** *
* * ** ** ** * ** * * *** ** * *

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

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

#include <stdlib.h>



int main()

{
** * ** ** * *** ** ** * * a[100];

    int q=0,w=0,e=0,n=0;
* * *** *** ** ********* * * * **** **
** * * * ***** ***** * (a[n]!='\0')

    {
* ** ** * *** *** * ** * **** *** ** * ** * * ** * *** ** *
* *** ***** * *** * * * ** ****** *** **** **** * * ** * * *
* * ****** * ** ** ** ** ** *** * ** * * * * ** *** if *************** * **** * **
** ** * * * * * * ** * * * * ** * * * ** *** * ** * * ** * * ** *
** * **** ** ******* *** **** * * *** * **
* ****** * ** * ** **** * ** ****** ** * ***** ** ** ** *** * *
*** * **** * ** ** * ************ ** * ***

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

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

#include <stdlib.h>



int main()

{
** *** * ** * * * * a[100];
** **** ** * * * * **** q=0,w=0,e=0,n=0;
* ** * ** *** * ** * * * *** * *
* * * * * * * (a[n]!='\0')

    {
**** *** * *** * * * * * *** * **** * ** * * * * * *
** ** ** * *** * * *** ** * ** * * ** * * * *** * ** * ** * *
** ** * ****** ***** ** ** * ** * ** ** **** * if (isdigit(a[n]))
* * ** * * *** * ** * * ** ******* **** * * * * **** * ** **
*** ** * ** ** ** * * ** ** **** *** ** * ** *** *
*** ******* ** **** * *** * ** * * * * * * * * * * * * *** ** * *** *
** * * * * * **** * * ** *** * *** * * **

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

}
answered by (-85 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.80.152
©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
| 525 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.7k 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.3k 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
| 565 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
| 844 views
12,783 questions
183,442 answers
172,219 comments
4,824 users