C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
Question
Book Icon
Chapter 8, Problem 7PP

(a)

Program Plan Intro

Program Plan: 

  • filename, population, totalCity, cityName, andmayor variables are used in the program.
  • c_str () andclose() functions are used in the program.

Program Description: The main purpose of the program is to create a file to store the collected information about the cities in your state. Prompt the user to enter the data of the each city’s name, their pollution, and the name of the mayor. Store the user-entered data in the file.

(b)

Program Plan Intro

Program Plan: 

  • filename, line, andcityInfovariables are used in the program.
  • getline (), fail (), c_str(), sort (), push_back (), eof (), close (),andexit () functions are used in the program.

Program Description: The main purpose of the program is to read the data from the file created in the exercise 7a. Sort the data in the alphabetically order by the city name.After sorting, display the data.

Blurred answer
Students have asked these similar questions
Scenario You work for a small company that exports artisan chocolate. Although you measure your products in kilograms, you often get orders in both pounds and ounces. You have decided that rather than have to look up conversions all the time, you could use Python code to take inputs to make conversions between the different units of measurement. You will write three blocks of code. The first will convert kilograms to pounds and ounces. The second will convert pounds to kilograms and ounces. The third will convert ounces to kilograms and pounds. The conversions are as follows: 1 kilogram = 35.274 ounces 1 kilogram = 2.20462 pounds 1 pound = 0.453592 kilograms 1 pound = 16 ounces 1 ounce = 0.0283 kilograms 1 ounce = 0.0625 pounds For the purposes of this activity the template for a function has been provided. You have not yet covered functions in the course, but they are a way of reusing code. Like a Python script, a function can have zero or more parameters. In the code window you…
make a screen capture showing the StegExpose results
Which of the following is not one of the recommended criteria for strategic objectives? Multiple Choice   a) realistic   b) appropriate   c) sustainable   d) measurable
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning