Write a C/C++ program to count the total number of alphabet-, numeric- or special characters in a string by reading each character until a newline character is reached. The string is entered by the user. Square bracket notation for array access is allowed for Question 2.1, i.e. array[i]. See the screenshot below (Figure 2.1) for example output. Hint: A direct comparison of two characters will compare the related ASCII values (see Table 2.1 below).
Write a C/C++ program to count the total number of alphabet-, numeric- or special characters in a string by reading each character until a newline character is reached. The string is entered by the user. Square bracket notation for array access is allowed for Question 2.1, i.e. array[i]. See the screenshot below (Figure 2.1) for example output. Hint: A direct comparison of two characters will compare the related ASCII values (see Table 2.1 below).
Chapter3: Data Representation
Section: Chapter Questions
Problem 5PE
Related questions
Question
Write a C/C++ program to count the total number of alphabet-, numeric- or special characters in a string by reading each character until a newline character is reached. The string is entered by the user. Square bracket notation for array access is allowed for Question 2.1, i.e. array[i]. See the screenshot below (Figure 2.1) for example output. Hint: A direct comparison of two characters will compare the related ASCII values (see Table 2.1 below).
![ASCII-Tabel / ASCII Table
NUL
16
DLE
32
SP
48
64
@
P
96
112
1
SOH
17
DC1
33
49
1
65
A
97
a
113
2
STX
18
DC2
34
50
66
82
R
98
b
114
r
3
ETX
19
DC3
35
51
3
67
83
S
99
115
4
EOT
20
DC4
36
2$
52
4
68
D
84
T
100
d
116
t
5
ENQ
21
NAK
37
응
53
5
69
E
85
U
101
e
117
u
6.
ACK
22
SYN
38
&
54
70
F
86
V
102
f
118
V
7
BEL
23
ETB
39
55
7
71
G
87
W
103
119
8.
BS
24
CAN
40
56
8.
72
88
104
h
120
9.
HT
25
EM
41
57
73
I
89
Y
105
i
121
10
26
42
106 |j| 122
LF
SUB
*
58
:
74
J
90
11
VT
27
ESC
43
+
59
75
K
91
107
k
123
{
12
FF
28
FS
44
60
76
92
108
1
124
13
CR
29
GS
45
61
77
M
93
109
125
=
14
SO
30
RS
46
62
>
78
N
94
110
n
126
15
SI
31
US
47
63
?
79
95
111
127
DEL
Tabel 2.1 / Table 2.1
Enter any string : "P3ter p[cked @ p&ck of pickled pepper5"
Alphabets
Digits
Special characters = 11
Process returned e (ex0)
Press any key to continue.
= 27
= 2
execution time : 149.539 s
|0 |고 |2 |3 |4 |5 |6 |7 |8 | |0 |고 |2 |3 | 4 |5
히0 |00 | 00 | 0 |00 |00 |0 |00 | 00 | 00 |9 | |0 |0 |이 |0
IN M n o](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fa9a71678-2b67-4d8b-9481-78db5bd55f40%2Fb0eeeac7-a563-4096-a514-9bbf6a8dd17a%2Ffjmagh_processed.png&w=3840&q=75)
Transcribed Image Text:ASCII-Tabel / ASCII Table
NUL
16
DLE
32
SP
48
64
@
P
96
112
1
SOH
17
DC1
33
49
1
65
A
97
a
113
2
STX
18
DC2
34
50
66
82
R
98
b
114
r
3
ETX
19
DC3
35
51
3
67
83
S
99
115
4
EOT
20
DC4
36
2$
52
4
68
D
84
T
100
d
116
t
5
ENQ
21
NAK
37
응
53
5
69
E
85
U
101
e
117
u
6.
ACK
22
SYN
38
&
54
70
F
86
V
102
f
118
V
7
BEL
23
ETB
39
55
7
71
G
87
W
103
119
8.
BS
24
CAN
40
56
8.
72
88
104
h
120
9.
HT
25
EM
41
57
73
I
89
Y
105
i
121
10
26
42
106 |j| 122
LF
SUB
*
58
:
74
J
90
11
VT
27
ESC
43
+
59
75
K
91
107
k
123
{
12
FF
28
FS
44
60
76
92
108
1
124
13
CR
29
GS
45
61
77
M
93
109
125
=
14
SO
30
RS
46
62
>
78
N
94
110
n
126
15
SI
31
US
47
63
?
79
95
111
127
DEL
Tabel 2.1 / Table 2.1
Enter any string : "P3ter p[cked @ p&ck of pickled pepper5"
Alphabets
Digits
Special characters = 11
Process returned e (ex0)
Press any key to continue.
= 27
= 2
execution time : 149.539 s
|0 |고 |2 |3 |4 |5 |6 |7 |8 | |0 |고 |2 |3 | 4 |5
히0 |00 | 00 | 0 |00 |00 |0 |00 | 00 | 00 |9 | |0 |0 |이 |0
IN M n o
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning