Starting Out with C++: Early Objects (9th Edition)
9th Edition
ISBN: 9780134400242
Author: Tony Gaddis, Judy Walters, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 3, Problem 21RQE
What header file must be included
A) to perform mathematical functions like sqrt ?
B) to use cin and cout?
C) to use stream manipluators like setprecision?
D) to use random numbers?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
In C++
Create a function called SuperRandomNumber. It should accept a number called top as the argument. It should output to a file 100 random numbers below top.
Code should be in Python, please
Complete the check_character() function which has 2 parameters: A string, and a specified index. The function checks the character at the specified index of the string parameter, and returns a string based on the type of character at that location indicating if the character is a letter, digit, whitespace, or unknown character.
Ex: The function calls below with the given arguments will return the following strings:
check_character('happy birthday', 2) returns "Character 'p' is a letter"check_character('happy birthday', 5) returns "Character ' ' is a white space"check_character('happy birthday 2 you', 15) returns "Character '2' is a digit"check_character('happy birthday!', 14) returns "Character '!' is unknown"
Common Time Zones
Function Name: commonTimeZones()
Parameters: code1( str ), code2( str)
Returns: list of common time zones ( list )
Description: You and your friend live in different countries, but you figure there's a chance that
both of you might be in the same time zone. Thus, you want to find out the list of possible time
zones that you and your friend could both be in. Given two country codes, write a function that
returns a list of the time zones the two countries have in common. Be sure not to include any
duplicate time zones. If the two country codes do not have any common time zones, return the
string 'No Common Time Zones' instead.
Note: You can assume that the codes will always be valid.
example test cases:
>>> commonTimeZones('can', 'usa')
[UTC-08:00', 'UTC-07:00', 'UTC-06:00', 'UTC-05:00', 'UTC-04:00]
>>> commonTimeZones('rus', 'chn')
[UTC+08:00]
For this assignment, use the REST countries API
(https://restcountries.com/#api-endpoints-v2).
For all of your requests, make…
Chapter 3 Solutions
Starting Out with C++: Early Objects (9th Edition)
Ch. 3.1 - Prob. 3.1CPCh. 3.1 - What is the symbol called?Ch. 3.1 - Where does cin read its input from?Ch. 3.1 - Prob. 3.4CPCh. 3.1 - Assume value is an integer variable. If the user...Ch. 3.1 - A program has the following variable definitions....Ch. 3.1 - The following program will run, but the user will...Ch. 3.1 - Complete the following main function so that it...Ch. 3.2 - In each of the following cases, tell which...Ch. 3.2 - Complete the following table by writing the value...
Ch. 3.2 - Prob. 3.11CPCh. 3.2 - Study the following program code and then complete...Ch. 3.2 - Complete the following program skeleton so that it...Ch. 3.3 - Assume the following variable definitions: int a =...Ch. 3.3 - What will the following program code display if a...Ch. 3.3 - What will the following program code display? int...Ch. 3.5 - Prob. 3.17CPCh. 3.5 - Complete the following program code segment so...Ch. 3.6 - Write a multiple assignment statement that assigns...Ch. 3.6 - Write statements using combined assignment...Ch. 3.6 - What will the following program segment display?...Ch. 3.7 - Write cout statements with stream manipulators...Ch. 3.7 - The following program segment converts an angle in...Ch. 3.8 - Will the following string literal fit in the space...Ch. 3.8 - If a program contains the definition string name;...Ch. 3.8 - Prob. 3.26CPCh. 3.10 - Use a mathematical library function with a cout...Ch. 3.10 - Assume the variables angle1 and angle2 hold angles...Ch. 3.10 - To find the cube root (the third root) of a...Ch. 3.10 - Write a statement that produces a random number...Ch. 3 - Prob. 1RQECh. 3 - Prob. 2RQECh. 3 - Prob. 3RQECh. 3 - Assume the following variables are defined: int...Ch. 3 - What header files must be included in the...Ch. 3 - Prob. 6RQECh. 3 - Prob. 7RQECh. 3 - Complete the following table. Expression Value of...Ch. 3 - Write C++ expressions for the following algebraic...Ch. 3 - Assume a program has the following variable...Ch. 3 - Prob. 11RQECh. 3 - Assume that qty and salesReps are both integers....Ch. 3 - Rewrite the following variable definition so the...Ch. 3 - Complete the following table by writing statements...Ch. 3 - Write a multiple assignment statement that can be...Ch. 3 - Write a pair of multiple assignment statements...Ch. 3 - Replace the following statements with a single...Ch. 3 - Is the following code legal? Why or why not? const...Ch. 3 - Write a cout statement that uses stream...Ch. 3 - Write a cout statement that uses stream...Ch. 3 - What header file must be included A) to perform...Ch. 3 - Pet World offers a 15 percent discount to senior...Ch. 3 - A bowling alley is offering a prize to the bowler...Ch. 3 - A retail store grants its customers a maximum...Ch. 3 - Little Italy Pizza charges 14.95 for a 12-inch...Ch. 3 - Trace the following program segments and tell what...Ch. 3 - A) (Assume the user enters George Washington.)...Ch. 3 - Each of the following program segments has some...Ch. 3 - A) const int number1, number2, product; cout ...Ch. 3 - Soft Skills Often programmers work in teams with...Ch. 3 - Miles per Gallon Write a program that calculates a...Ch. 3 - Stadium Seating There are three searing categories...Ch. 3 - Housing Costs Write a program that asks the user...Ch. 3 - How Much Insurance? Many financial experts advise...Ch. 3 - Batting Average Write a program to find a baseball...Ch. 3 - Test Average Write a program that asks for five...Ch. 3 - Average Rainfall Write a program that calculates...Ch. 3 - Male and Female Percentages Write a program that...Ch. 3 - Vacation Days Write a program that prompts the...Ch. 3 - Box Office A movie theater only keeps 80 percent...Ch. 3 - How Many Widgets? The Yukon Widget Company...Ch. 3 - How many Calories? A bag of cookies holds 30...Ch. 3 - Ingredients Adjuster A cookie recipe calls for the...Ch. 3 - Celsius to Fahrenheit Write a program that...Ch. 3 - Currency Write a program that will convert U.S....Ch. 3 - Monthly Sales Tax A retail company muse file a...Ch. 3 - Property Tax Madison County collects property...Ch. 3 - Senior Citizen Property Tax Madison County...Ch. 3 - Math Tutor Write a program that can be used as a...Ch. 3 - Interest Earned Assuming there are no deposits...Ch. 3 - Monthly Payments The monthly payment on a loan may...Ch. 3 - Pizza Slices Joe's Pizza Palace needs a program to...Ch. 3 - How Many Pizzas? Modify the program you wrote in...Ch. 3 - Angle Calculator Write a program that asks the...Ch. 3 - Stock Transaction Program Last month Joe purchased...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
7.13* For a bearing
DE = NUS 5 53’56 ”WT and angles to the right, compute the bearing of PG if angle
DEF 2 88°...
Elementary Surveying: An Introduction To Geomatics (15th Edition)
In Exercises 55 through 60, find the value of the given function where a and b are numeric variables of type Do...
Introduction To Programming Using Visual Basic (11th Edition)
Porter’s competitive forces model: The model is used to provide a general view about the firms, the competitors...
Management Information Systems: Managing The Digital Firm (16th Edition)
Given that the int variable temp contains a temperature that is not negative, write a Java statement that uses ...
Java: An Introduction to Problem Solving and Programming (8th Edition)
A file that contains a Flash animation uses the __________ file extension. a. .class b. .swf c. .mp3 d. .flash
Web Development and Design Foundations with HTML5 (8th Edition)
When working with a sequential access file, you can jump directly to any piece of data in the file without read...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
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.Similar questions
- Common Time Zones Function Name: commonTimeZones() Parameters: code1( str ) , code2( str ) Returns: list of common time zones ( list ) Description: You and your friend live in different countries, but you figure there's a chance that both of you might be in the same time zone. Thus, you want to find out the list of possible time zones that you and your friend could both be in. Given two country codes, write a function that returns a list of the time zones the two countries have in common. Be sure not to include any duplicate time zones. If the two country codes do not have any common time zones, return the string 'No Common Time Zones' instead. Note: You can assume that the codes will always be valid. example test cases: >>> commonTimeZones('can', 'usa') ['UTC-08:00', 'UTC-07:00', 'UTC-06:00', 'UTC-05:00', 'UTC-04:00'] >>> commonTimeZones('rus', 'chn') ['UTC+08:00'] For this assignment, use the REST countries API…arrow_forwardBody Mass Index Write a program that reads names, weights, and heights from bmi.dat (provided with starter code; do not change the file name). Use the information to calculate and displays a person’s body mass index (BMI). The BMI is often used to determine whether a person with a sedentary lifestyle is overweight or underweight for his or her height. A person’s BMI is calculated with the following formula: BMI = weight × 703 / height2 where weight is measured in pounds and height is measured in inches. The file is in the format name weightInKG heightInCM You will read the name, weight and height for 4 people from the file, and you will need to convert the weights in the file to pounds (note that 1 kilogram = 2.2 pounds) and the heights to inches (2.54 cm = 1 inch). The program should display the person's name along with the calculated BMI and a message indicating whether the person has optimal weight, is underweight, or is overweight. Your output should look like A person’s weight…arrow_forwardWhat is the purpose of the manipulator setprecision? Which header file must be included to use the function setprecision?arrow_forward
- What does function sqrt do? Which header file must be included to use the function sqrt?arrow_forwardplease code in pythonRead in and return a list of review dates. The function should ask the user to enter some review dates This should be entered in the format mm/dd/yyyy (same as that in the file) where dd is two-digit day, mm is two digit month and yyyy is a four digit year e.g. 01/22/2020 The function should return a list containing the specified review dates. :return: a list of review datesYou can take any review date as sample examplearrow_forwardc++ programming languagearrow_forward
- Average grades bar chart Write a python program grades.py that reads a file of assignment grades and draws a bar chart of the average grades for each assignment. Save the figure as grades.png in the current working directory. The format of a line in the file is: assignment_type grade Note that there is a single space between the assignment type and the grade. E.g. exam 92.80 Your program must contain the following functions: Function name Function description Function input(s) Function return value(s) get_grades() This function takes a file name as input and populates a dictionary containing the assignment types and grades. Filename string Dictionary of grades main() This function prompts for the grades file name. Next, it calls the functions get_grades(). Next, it draws the bar chart of the average grade for each assignment. Hint: You can use the mean function of the statistics module to calculate the average of a list. None None Use the starter…arrow_forwardIn C++ Create a function called Swap. It should take in two numbers by reference (use the & operator for this) and ensure that firstNum is the larger one and secondNum is the smaller one.arrow_forward2. Dog Years File: dog_years.py In Prac 3 you wrote a program to calculate a dog's age in dog years.Rewrite this program using a function for the conversion.Write a main function that repeatedly asks the user for an age in human years, then displays it in dog years until the user enters a negative number.Don't do any error checking on this age. Here's the calculation part already: if human_years <= 2: dog_years = human_years * 10.5 else: dog_years = 21 + 4 * (human_years - 2) 3. Seconds Display File: seconds.py In Prac 2 you wrote a program to calculate and display deep sleep time/percentage.In that program, you displayed seconds as minutes and seconds, example: Total sleep in seconds: 161 Deep sleep in seconds : 62 Deep sleep : 1m 2s Total sleep: 2m 41s Percentage : 38.50931677018634% Note: the original program from prac 2 was about sleep, but this question is not related to that context.The technique for figuring out minutes and seconds from just seconds is the same,…arrow_forward
- I need help writing a C++ code. I need help writing a program that uses a structure to score the following information on a company division.: Division name( East, West, North, South)Quarter (1,2,3,4) Quarterly salesThe user should be asked for the four Quarters' sales figures for the east, west, north, and south divisions. The information for each quarter for each division needs to be written to a file.arrow_forwardProblem description: Write a python application to simulate an Amazon online book shoppingsystem, namely “Amazing”. Design solution: The template file contains a list of books sold on Amazing, each item in the listcontains the title, publication year, author and the prices. The program will generate anitems_dict where each key is the title of the book and the values will be a list of year, authorand price information. A customer will be presented with a main menu with 4 different options:display all items, add an item to cart, checkout and exit the program. A customer can buy anitem by entering the title of the book. This program implements a dictionary called cart, whereeach key is the title and the values are the list of year, author and price and We assume onecopy is added with each selection. The program keeps repeating by displaying the main menuto user until user hits the quit button. If user hits the checkout option, the program will displayall the items in the cart and display…arrow_forwardplease code in pythonis_phone_num: This Boolean function takes a string and returns True if it is in the formatddd-ddd-dddd, where d is a digit, False otherwise. Example calls:is_phone_num('123-456-7890') --> Trueis_phone_num('123-4556-7890') --> Falseis_phone_num('(123)456-7890') --> Falsearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
functions in c programming | categories of function |; Author: Education 4U;https://www.youtube.com/watch?v=puIK6kHcuqA;License: Standard YouTube License, CC-BY