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 container. Output all unique countries from the set. Output the total number of entries in your set.
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 container. Output all unique countries from the set. Output the total number of entries in your set.
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
Warning- Don't use AI or copied answer. I'll reduce rating if I see these things.
Expert Solution
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 5 steps with 4 images
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…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT