2. Characters in Strings A large part of the text processing done by computers involves reading user input and figuring out what it means. We'll do something like that today: given a string supplied by a user, we report (1) the total length of the string, (2) how many alphabetic characters, (3) how many numeric characters, (4) how many vowels (a, e, i, o, u) were in that string, and (5) how many of the alphabetics were upper-case. For example, if a user input this line: the program would say: String length: 30 James Bond, 007, works for MI6 Alphabetics: 19, upper-case: 4 Numerics: 4 Vowels: 6

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 16PP: (Computation) Among other applications, Pascal’s triangle (see Figure 7.22) provides a means of...
icon
Related questions
Topic Video
Question
2. Characters in Strings
A large part of the text processing done by computers involves reading user input and figuring out what it
means. We'll do something like that today: given a string supplied by a user, we report (1) the total length
of the string, (2) how many alphabetic characters, (3) how many numeric characters, (4) how many vowels
(a, e, i, o, u) were in that string, and (5) how many of the alphabetics were upper-case.
For example, if a user input this line:
the program would say:
String length: 30
James Bond, 007, works for MI6
Alphabetics: 19, upper-case: 4
Numerics: 4
Vowels: 6
You will need to use a new (to us) function to read the user input. You have been using cin but this won't
work for your needs in this program. Instead, use getline (cin,s) where s is a string variable. That
string will contain everything the user typed up to but not including the Enter the user typed to end the
line.
So you have a string but you'll need a loop to check for each individual character in the string to see if it's
an alphabetic, a numeric, or something else.
Transcribed Image Text:2. Characters in Strings A large part of the text processing done by computers involves reading user input and figuring out what it means. We'll do something like that today: given a string supplied by a user, we report (1) the total length of the string, (2) how many alphabetic characters, (3) how many numeric characters, (4) how many vowels (a, e, i, o, u) were in that string, and (5) how many of the alphabetics were upper-case. For example, if a user input this line: the program would say: String length: 30 James Bond, 007, works for MI6 Alphabetics: 19, upper-case: 4 Numerics: 4 Vowels: 6 You will need to use a new (to us) function to read the user input. You have been using cin but this won't work for your needs in this program. Instead, use getline (cin,s) where s is a string variable. That string will contain everything the user typed up to but not including the Enter the user typed to end the line. So you have a string but you'll need a loop to check for each individual character in the string to see if it's an alphabetic, a numeric, or something else.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Instruction Format
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Fundamentals of Information Systems
Fundamentals of Information Systems
Computer Science
ISBN:
9781305082168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning