Starting Out with C++ from Control Structures to Objects, Student Value Edition (9th Edition)
Starting Out with C++ from Control Structures to Objects, Student Value Edition (9th Edition)
9th Edition
ISBN: 9780134443829
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 3.5, Problem 3.13CP

Explanation of Solution

Given Program:

//Include the header files

#include <iostream>

using namespace std;

//Main function

int main()

{

//Declare the variables

int integer1, integer2;

double result;

//Intialize the variables

integer1 = 19;

integer2 = 2;

/*Divide the integers and store the result in a variable*/

result = integer1 / integer2;

//Print the result

cout << result << endl;

/*Divide the integers by type-casting the first integer and store the result in a variable*/

result = static_cast<double>(integer1) / integer2;

//Print the result

cout << result << endl;

/*Divide the integers by type-casting the both integers and store the result in a variable*/

result = static_cast<double>(integer1 / integer2);

//Print the result

cout << result << endl;

//Return the statement

return 0;

}

Explanation:

  • The first process in the program is to include the required header files...

Blurred answer
Students have asked these similar questions
A sphere is characterized by a single dimensions; its radius (r). The surface area of the sphere is calculated as A=4πr2 While the volume is calculated as V=43πr3 Write a program that asks the user for r and when VALID proceeds to calculate both the surface area and the volume of the sphere by calling a single function. The function's prototype is as follows: void sphereCalc(float, float *, float *); All console input and output operations are in main(). Print the area and volyme with 3 decimal places. Follow best programming practices. Use r = 3 for the screenshot. Hint: Define PI using #define PI 3.1415927
This exercise is about the demonstration of the basic programming skills learnt during the previous labs. Exercise 2.1 Write a Program in C++ for a grocery shop payment bill/ receipt. The program should display the final bill/receipt in the following format with and without built-in formatting functions e.g., setw(). Note: You are not required to input the data and perform calculations for Ex 2.1. You are required to output the data in the correct format. \” Food Stuff Grocery Shop”/ Customer Name: Salim ITEM -------- Fresh Milk Apple Bread Coffee ----------------------------------------------------------------------------------------------------------------------- PRICE --------- 1.0 OMR 2.0 OMR 0.8 OMR Sales Tax+ VAT ----------------------- 0.05 Gross Bill ------------ Discount ------------- Net Bill --------------- 2.5 OMR 2.65 OMR 0.10 0.05 0.15 Sub-Total ---------------- 1.05 OMR 2.10 OMR 1.30 OMR 7.1 OMR 5% 6.745 OMR Exercise 2.2 Write a C++ program to automate…
Write a program in C that has three float variable (place random values in them) and that will call thefunctions below using these variables as arguments.Create a function named pizza that takes three float arguments and returns the lowest value of them.Call the function pizza on the three variables and output the function return to the screen.Create a function named burger that takes three float arguments and returns the highest value of them.Call the function pizza on the three variables and output the function return to the screen.Create a function named hotdog that takes three float arguments and returns the middle value of them.Call the function pizza on the three variables and output the function return to the screen. Do not use rand function

Chapter 3 Solutions

Starting Out with C++ from Control Structures to Objects, Student Value Edition (9th Edition)

Ch. 3.5 - Assume the following variable definitions: int a =...Ch. 3.5 - Complete the following program skeleton so it asks...Ch. 3.5 - Prob. 3.13CPCh. 3.6 - Write a multiple assignment statement that assigns...Ch. 3.6 - Write statements using combined assignment...Ch. 3.6 - Prob. 3.16CPCh. 3.7 - Write cout statements with stream manipulators...Ch. 3.7 - Prob. 3.18CPCh. 3.7 - The following program skeleton asks for an angle...Ch. 3.9 - Prob. 3.20CPCh. 3.9 - Assume the variables angle1 and angle2 hold angles...Ch. 3.9 - To find the cube root (the third root) of a...Ch. 3.9 - The cosecant of the angle a is 1sina Write a...Ch. 3 - Assume the following variables are defined: int...Ch. 3 - Prob. 2RQECh. 3 - Prob. 3RQECh. 3 - Complete the following table by determining the...Ch. 3 - Write C++ expressions for the following algebraic...Ch. 3 - Assume a program has the following variable...Ch. 3 - Assume a program has the following variable...Ch. 3 - Assume qty and salesReps are both integers. Use a...Ch. 3 - Rewrite the following variable definition so that...Ch. 3 - Complete the following table by providing...Ch. 3 - Write a multiple assignment statement that can be...Ch. 3 - Write a cout statement so the variable divSales is...Ch. 3 - Write a cout statement so the variable totalAge is...Ch. 3 - Prob. 14RQECh. 3 - The__________ library function returns the cosine...Ch. 3 - The ___________ library function returns the sine...Ch. 3 - The ________ library function returns the tangent...Ch. 3 - The __________ library function returns the...Ch. 3 - The _________ library functionreturns the...Ch. 3 - The _________ library function returns the natural...Ch. 3 - Prob. 21RQECh. 3 - The _______ library function returns the value of...Ch. 3 - The _________ libraryfunction returns the square...Ch. 3 - The ________ file must beincluded in aprogramthat...Ch. 3 - A retail store grants its customers a maximum...Ch. 3 - Write a pseudocode algorithm for a program that...Ch. 3 - Write a pseudocode algorithm for a program that...Ch. 3 - using namespace std; int main () { double number1,...Ch. 3 - #include iostream using namespace std; int main()...Ch. 3 - #include iostream; using namespace std; int main()...Ch. 3 - #include iostream; using namespace std; main { int...Ch. 3 - #inc1ude iostream; using namespace std; main {...Ch. 3 - #inc1ude iostream; using namespace std; int main()...Ch. 3 - What will each of the following programs display?...Ch. 3 - #include iostream using namespace std; int main()...Ch. 3 - (Assume the user enters George Washington.)...Ch. 3 - (Assume the user enters 36720152. Use a...Ch. 3 - Miles per Gallon Write a program that calculates a...Ch. 3 - Stadium Seating There are three seating categories...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 - Ingredient Adjuster A cookie recipe calls for the...Ch. 3 - Box Office A movie theater only keeps a percentage...Ch. 3 - How Many Widgets? The Yukon Widget Company...Ch. 3 - How Many Calories? A bag of cookies holds 30...Ch. 3 - How Much Insurance? Many financial experts advise...Ch. 3 - Automobile Costs Write a program that asks 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 must file a...Ch. 3 - Property Tax A county collects property taxes on...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 Pi Joes 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...Ch. 3 - Planting Grapevines A vineyard owner is planting...Ch. 3 - Word Game Write a program that plays a word game...
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education