0 like 0 dislike
12.6k views

Write a program that ask the user to input a serial character (max 1000). Prints a table showing how many time each digit appears in the number. You should see 'A' and 'a' as the same.

寫一個程式 求使用者輸入一字串(最大1000) 輸入字母出現的次數 (A跟a算一樣)

Example input

Write a program that ask the user to input a serial character. Prints a table showing how many time each digit appears in the number. You should see 'A' and 'a' as the same.

Example output

A 19
B 2
C 3
D 3
E 15
F 0
G 3
H 9
I 9
J 0
K 1
L 3
M 5
N 7
O 6
P 5
Q 0
R 10
S 10
T 13
U 5
V 0
W 3
X 0
Y 2
Z 0

 

[Exercise] Coding (C) - asked in Chapter 8: Arrays by (5.2k points)
ID: 39985 - Available when: Unlimited - Due to: Unlimited

edited by | 12.6k views

31 Answers

0 like 0 dislike
Hidden content!
#include ** * * *****
#include **** * *** ***

#define MAX_SIZE 1000 //Maximum size of the string

int main()
{
* ** ** *** ****** string[MAX_SIZE];
* * * ** ** ***** i, len;
* * *** ** ** ***** * frequency[26] = {0};

*** * * **** **** **** ****** * ** * ** string);

*** * *** * ** *** * = strlen(string);

** * * ** * * * * * * * i<len; i++){
** ****** * * ** ***** * ** ** *** **** *** * * * **** * * && string[i]<='z'){
** ** * ***** * * ** * * *** ******** *** **** * * ** * *** - 97]++;
**** ** * * * ** * ** * * *** ** * *** *** ** *
** **** * * * *** * * * ******* *** * *** && * *** *** ** *
* **** * * * **** *** * ** ***** * * ** ***** * * * * ** * * * * * ** - 65]++;
* ***** ***** * **** ** ** * ** ** *
* ** * ** *** *

*** ** * * * * * * ** **** * i<26; i++)
*** *** * * ***** * *
*** ** ** ***** * *** * * ** ***** * * * * *** * <25)
** ** **** * * ** * * *** * ** * * * * * * * ******* * * * *** * * %d\n", (i+65), frequency[i]);
* * ** ** * **** * **** * * *** *** * *** * *
* **** *** *** ******* * * * * ** * ** ***** ** * ** ** **** *** *** %d", (i+65), frequency[i]);
** * * * * *** * **

** ** ** ** ** * ***** *** * 0;
}
answered by (5.2k points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.197.8
©2016-2026

Related questions

0 like 0 dislike
102 answers
[Exercise] Coding (C) - asked Dec 28, 2017 in Chapter 8: Arrays by semicolon (5.2k points)
ID: 39984 - Available when: Unlimited - Due to: Unlimited
| 25.4k views
0 like 0 dislike
56 answers
[Exercise] Coding (C) - asked Nov 29, 2017 in Chapter 8: Arrays by semicolon (5.2k points)
ID: 34913 - Available when: 2017-11-30 18:00 - Due to: Unlimited
| 14.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users