C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
bartleby

Videos

Question
Book Icon
Chapter 3.3, Problem 2E

(a)

Program Plan Intro

Program description:

The following program will determine the value of int(a) where value of a=10.6.

(a)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6
floata=10.6;
//determine and print the value of int(a)
cout<<int(a);
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6, which is floating-point type value. The int(a) will typecast the value of a to integer type so that it will print only integer part only.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  1

(b)

Program Plan Intro

The following program will determine the value of int(b) where the value of b=13.9.

(b)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable b with value 13.9
floatb=13.9;
//determine and print the value of int(b)
cout<<int(b);
//exiting from program
return0;
}

Explanation:

In the above code, the value of b is 13.9, which is floating-point type value. The int(b) will typecast the value of a to integer type so that it will print only integer part only.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  2

(c)

Program Plan Intro

The following program will determine the value of int(c) where the value of c=-3.42.

(c)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable c with value -3.42
floatc=-3.42;
//determine and print the value of int(c)
cout<<int(c);
//exiting from program
return0;
}

Explanation:

In the above code, the value of c is -3.42, which is floating-point type value. The int(c) will typecast the value of a to integer type so that it will print only integer part only.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  3

(d)

Program Plan Intro

The following program will determine the value of int(a+b) where the value of a=10.6 and b=13.9.

(d)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6 and bwith value 13.9
float a=10.6, b=13.9;
//determine and print the value of int(a+b)
cout<<int(a+b);
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6 and b is 13.9, which is floating-point type value. The int(a+b) will first add the value a and b then typecast the value of its result to an integer type and then print the value using cout statement.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  4

(e)

Program Plan Intro

The following program will determine the value of int(a+b) where the value of a=10.6, b=13.9 and c=-3.42.

(e)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6, b with 13.9 and c with -3.42
float a=10.6, b=13.9, c=-3.42;
//determine and print the value of int(a)+b+c
cout<<int(a)+b+c;
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6, b is 13.9, and c is -3.42, which is floating-point type value. The int(a)+b+c will typecast the value of a to an integer type and then add and print the integer value of a, b and c.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  5

(f)

Program Plan Intro

The following program will determine the value of int(a+b)+c where the value of a=10.6, b=13.9 and c=-3.42.

(f)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6, b with 13.9 and c with -3.42
float a=10.6, b=13.9, c=-3.42;
//determine and print the value of int(a+b)+c
cout<<int(a+b)+c;
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6, b is 13.9, and c is -3.42, which is floating-point type value. The int(a+b) will first add the value a and b then typecast the value of its result to an integer type and then add the value of c to it.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  6

(g)

Program Plan Intro

The following program will determine the value of int(a+b+c) where the value of a=10.6, b=13.9 and c=-3.42.

(g)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6, b with 13.9 and c with -3.42
float a=10.6, b=13.9, c=-3.42;
//determine and print the value of int(a+b+c)
cout<<int(a+b+c);
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6, b is 13.9, and c is -3.42, which is floating-point type value. The int(a+b+c) will first add the value of a, b and c then typecast the value of its result to an integer type and print the value using cout statement.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  7

(h)

Program Plan Intro

The following program will determine the value of float(int(a))+b where the value of a=10.6and b=13.9.

(h)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6 and b with 13.9
float a=10.6, b=13.9, c=-3.42;
//determine and print the value of float(int(a))+b 
cout<<float(int(a))+b ;
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6and b is 13.9, which is floating-point type value. The float(int(a))+bwill first typecast the value of a to an integer type and then typecast this integer value to float and then add value b to it and print the value using cout statement.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  8

(i)

Program Plan Intro

The following program will determine the value of float(int(a+b)) where the value of a=10.6and b=13.9.

(i)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6 and b with 13.9
float a=10.6, b=13.9, c=-3.42;
//determine and print the value of float(int(a+b))  
cout<<float(int(a+b))  ;
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6and b is 13.9, which is floating-point type value. The float(int(a+b))will first add the value of a+b and then typecast the value of its result to an integer type and then typecast this integer value to float and print the value using cout statement.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  9

(j)

Program Plan Intro

The following program will determine the value of abs(a)+abs(b) where the value of a=10.6and b=13.9.

(j)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
#include <cmath>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6 and b with 13.9
float a=10.6, b=13.9, c=-3.42;
//determine and print the value of abs(a)+abs(b) 
cout<<abs(a)+abs(b)   ;
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6and b is 13.9, which is floating-point type value. The abs(a) and abs(b)function are used to get the absolute value of a and b then add this absolute value with each other and print the value using cout statement.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  10

(j)

Program Plan Intro

The following program will determine the value of sqrt(abs(a-b)) where the value of a=10.6and b=13.9.

(j)

Expert Solution
Check Mark

Explanation of Solution

Program

//included header file
#include <iostream>
#include <cmath>
//included namespace
usingnamespacestd;
//main function
intmain()
{
//declare variable a with value 10.6 and b with 13.9
float a=10.6, b=13.9, c=-3.42;
//determine and print the value of sqrt(abs(a-b)) 
cout<<sqrt(abs(a-b));
//exiting from program
return0;
}

Explanation:

In the above code, the value of a is 10.6and b is 13.9, which is floating-point type value. The abs(a-b)function will determine the absolute value of a-b then the sqrt()function will determine the square root value of this resultand print the value using cout statement.

Sample Output:

  C++ for Engineers and Scientists, Chapter 3.3, Problem 2E , additional homework tip  11

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
2. [20 pts] Student A B will enjoy his picnic on sunny days that have no ants. He will also enjoy his picnic any day he sees a hummingbird, as well as on days where there are ants and ladybugs. a. Write a Boolean equation for his enjoyment (E) in terms of sun (S), ants (A), hummingbirds (H), and ladybugs (L). b. Implement in Logisim, the logic circuit of E function. Use the Circuit Analysis tool in Logisim to view the expression, include an image of the expression generated by Logisim
How would I go about creating this computer database in MariaDB with sql? Create a database name "dbXXXXXX" Select the database using the "use [database name]" command. Now you are in the database. Based on the above schema from Enrolment System database, create all the tables with the last 6 digits of  "123456", then the table name for table Lecturer should be "123456_Lecturer". Refer to basic SQL lecture note to create table that has primary keys and Foreign Keys. Provide the datatype of each attributes. Add a column called "Department" with datatype "VARCHAR(12)" to the table "Lecturer". Shows the metadata of the updated "Lecturer" table. (Use Describe command) Drop the "Department" column from the table "Lecturer", and show the metadata of the updated "Lecturer" table. Insert three (3) data to each of the table in the tables created.  Note: If you have foreign key issues, please disable foreign key constraints before inserting the data, see below SET FOREIGN_KEY_CHECKS=0;…
CSE330 Discrete Mathematics 1. In the classes, we discussed three forms of floating number representations as given below, (1) Standard/General Form, (2) Normalized Form, (3) Denormalized Form. 3. Consider the real number x = (3.395) 10 (a) (b) Convert the decimal number x into binary format up to 7 binary places (7 binary digits after decimal) Convert the calculated value into denormalized form and calculate fl(x) for m=4 Don't use any Al tool show answer in pen a nd paper then take pi ctures and send

Chapter 3 Solutions

C++ for Engineers and Scientists

Ch. 3.1 - (Debug) Determine and correct the errors in the...Ch. 3.1 - Prob. 12ECh. 3.1 - Prob. 13ECh. 3.1 - (General math) The area of an ellipse (see Figure...Ch. 3.1 - Prob. 15ECh. 3.2 - Prob. 1ECh. 3.2 - Prob. 2ECh. 3.2 - (Practice) Write a C++ program that displays the...Ch. 3.2 - Prob. 4ECh. 3.2 - Prob. 5ECh. 3.2 - Prob. 6ECh. 3.2 - Prob. 7ECh. 3.2 - Prob. 8ECh. 3.2 - (Electrical eng.) The combined resistance of three...Ch. 3.2 - Prob. 10ECh. 3.2 - Prob. 11ECh. 3.2 - (Civil eng.) Write a C++ program to calculate and...Ch. 3.3 - Prob. 1ECh. 3.3 - Prob. 2ECh. 3.3 - (Practice) Write C++ statements for the following:...Ch. 3.3 - Prob. 4ECh. 3.3 - (General math) Write, compile, and run a C++...Ch. 3.3 - (General math) If a 20-foot ladder is placed on...Ch. 3.3 - (Physics) The maximum height reached by a ball...Ch. 3.3 - (Transportation) Road construction requires...Ch. 3.3 - Prob. 9ECh. 3.3 - Prob. 10ECh. 3.3 - Prob. 11ECh. 3.3 - Prob. 12ECh. 3.4 - Prob. 1ECh. 3.4 - (Practice) a. Write a C++ program that first...Ch. 3.4 - Prob. 3ECh. 3.4 - Prob. 4ECh. 3.4 - Prob. 5ECh. 3.4 - Prob. 6ECh. 3.4 - (General math) a. Write, compile, and run a C++...Ch. 3.4 - Prob. 8ECh. 3.4 - Prob. 9ECh. 3.4 - (Electrical eng.) For the series circuit shown in...Ch. 3.4 - Prob. 11ECh. 3.4 - Prob. 12ECh. 3.4 - Prob. 13ECh. 3.5 - Prob. 1ECh. 3.5 - Prob. 2ECh. 3.5 - Prob. 3ECh. 3.5 - Prob. 4ECh. 3.5 - Prob. 5ECh. 3.6 - Prob. 1ECh. 3.6 - (General math) The value of p can be approximated...Ch. 3.6 - Prob. 3ECh. 3.6 - (General math) The volume of oil stored in an...Ch. 3.6 - Prob. 5ECh. 3.6 - (General math) The perimeter, approximate surface...Ch. 3.6 - Prob. 7ECh. 3.6 - Prob. 8ECh. 3.6 - Prob. 9ECh. 3 - (General math) a. Write a C++ program to calculate...Ch. 3 - General math) a. Write a C++ program to calculate...Ch. 3 - (General math) Modify the program written for...Ch. 3 - (Biology) The number of bacteria, B, in a culture...Ch. 3 - Prob. 5PPCh. 3 - (Heat transfer) The formula developed in Exercise...Ch. 3 - Prob. 7PPCh. 3 - (Electrical eng.) a. The voltage gain of an...Ch. 3 - (Electrical eng.) a. Write, compile, and run a C++...Ch. 3 - (Electrical eng.) The amplification of electronic...Ch. 3 - (Acoustics) The loudness of a sound is measured in...Ch. 3 - (General math) a. A balance has the following...
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
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
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Boolean Algebra - Digital Logic and Logic Families - Industrial Electronics; Author: Ekeeda;https://www.youtube.com/watch?v=u7XnJos-_Hs;License: Standard YouTube License, CC-BY
Boolean Algebra 1 – The Laws of Boolean Algebra; Author: Computer Science;https://www.youtube.com/watch?v=EPJf4owqwdA;License: Standard Youtube License