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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
# 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 inputs this line:
```
James Bond, 007, works for MI6
```
the program would say:
- String length: 30
- 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:# 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 inputs this line: ``` James Bond, 007, works for MI6 ``` the program would say: - String length: 30 - 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
Step 1

These question answer is as follows

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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education