Suppose you have a file named "Countries.txt" containing a list of countries: USA, Brazil, Germany, India, Japan, Australia, Canada, Mexico, China, France, South Korea,Italy, Spain, Argentina, Russia, Sweden, Turkey, Nigeria, Egypt, South Africa
Suppose you have a file named "Countries.txt" containing a list of countries: USA, Brazil, Germany, India, Japan, Australia, Canada, Mexico, China, France, South Korea,Italy, Spain, Argentina, Russia, Sweden, Turkey, Nigeria, Egypt, South Africa
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 8PE: Write a program that reads in a line consisting of a students name, Social Security number, user ID,...
Related questions
Question
100%
Don't try to copy other's work or don't use any AI platform to generate answer. If I see these things I'll give you multiple downvotes for sure and will report.
![Suppose you have a file named "Countries.txt"
containing a list of countries:
USA, Brazil, Germany, India, Japan, Australia,
Canada, Mexico, China, France,
South Korea, Italy, Spain, Argentina, Russia, Sweden,
Turkey, Nigeria, Egypt, South Africa
Write a C++ program that reads the countries from
the file and performs the following tasks:
Output all the countries in your STL list of strings.
Output all countries that have a length greater than
5 characters.
Output all countries that do not start with the letter
'S'.
Calculate the sum of ASCII values of all characters in
each country and store the result in a histogram of
length 5, where each element represents a range of
values (e.g., 0-100, 101-200, etc.).
Store all the countries in an STL set<string>
container.
Output all unique countries from the set.
Output the total number of entries in your set.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb8fc6e08-153f-4544-a5e1-d1149c12f94e%2Fe57e306a-80e5-43a9-8885-66159b4b9d44%2Fexleg2r_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Suppose you have a file named "Countries.txt"
containing a list of countries:
USA, Brazil, Germany, India, Japan, Australia,
Canada, Mexico, China, France,
South Korea, Italy, Spain, Argentina, Russia, Sweden,
Turkey, Nigeria, Egypt, South Africa
Write a C++ program that reads the countries from
the file and performs the following tasks:
Output all the countries in your STL list of strings.
Output all countries that have a length greater than
5 characters.
Output all countries that do not start with the letter
'S'.
Calculate the sum of ASCII values of all characters in
each country and store the result in a histogram of
length 5, where each element represents a range of
values (e.g., 0-100, 101-200, etc.).
Store all the countries in an STL set<string>
container.
Output all unique countries from the set.
Output the total number of entries in your set.
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.
Step by step
Solved in 3 steps with 2 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
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT