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

Concept explainers

Question
Book Icon
Chapter 4.1, Problem 4.1CP

A)

Program Plan Intro

Relational Operators:

Relational operators are used to compare numeric and character values using the following operators:

  • Greater than (>)
  • Less than (<)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
  • Equal to (==)
  • Not equal to (!=)

These operators will determine whether specific relationship exists between two values of same type.

Relational Expression:

Relational operators are “binary”, so it needs two operands for comparison. Consider the following expression using the less-than operator:

A < B

  • The above expression is called a “relational expression”. It is used to find whether “A” is less than “B”.
  • Relational expression is also referred as “Boolean expression”, because the resultant value of all relational expression is either “True” or “False”. But the states of Boolean values are stored as 0 and 1.
  • Hence, if the resultant value of relational expression is 0, then the expression is “False”. If the resultant value of relational expression is 1, then the expression is “True”.

Evaluating the given relational expression is “true” or “false”:

The below expressions are evaluated using the values that are given:

x=5;

y=6;

z=8;

B)

Program Plan Intro

Relational Operators:

Relational operators are used to compare numeric and character values using the following operators:

  • Greater than (>)
  • Less than (<)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
  • Equal to (==)
  • Not equal to (!=)

These operators will determine whether specific relationship exists between two values of same type.

Relational Expression:

Relational operators are “binary”, so it needs two operands for comparison. Consider the following expression using the less-than operator:

A < B

  • The above expression is called a “relational expression”. It is used to find whether “A” is less than “B”.
  • Relational expression is also referred as “Boolean expression”, because the resultant value of all relational expression is either “True” or “False”. But the states of Boolean values are stored as 0 and 1.
  • Hence, if the resultant value of relational expression is 0, then the expression is “False”. If the resultant value of relational expression is 1, then the expression is “True”.

Evaluating the given relational expression is “true” or “false”:

The below expressions are evaluated using the values that are given:

x=5;

y=6;

z=8;

C)

Program Plan Intro

Relational Operators:

Relational operators are used to compare numeric and character values using the following operators:

  • Greater than (>)
  • Less than (<)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
  • Equal to (==)
  • Not equal to (!=)

These operators will determine whether specific relationship exists between two values of same type.

Relational Expression:

Relational operators are “binary”, so it needs two operands for comparison. Consider the following expression using the less-than operator:

A < B

  • The above expression is called a “relational expression”. It is used to find whether “A” is less than “B”.
  • Relational expression is also referred as “Boolean expression”, because the resultant value of all relational expression is either “True” or “False”. But the states of Boolean values are stored as 0 and 1.
  • Hence, if the resultant value of relational expression is 0, then the expression is “False”. If the resultant value of relational expression is 1, then the expression is “True”.

Evaluating the given relational expression is “true” or “false”:

The below expressions are evaluated using the values that are given:

x=5;

y=6;

z=8;

D)

Program Plan Intro

Relational Operators:

Relational operators are used to compare numeric and character values using the following operators:

  • Greater than (>)
  • Less than (<)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
  • Equal to (==)
  • Not equal to (!=)

These operators will determine whether specific relationship exists between two values of same type.

Relational Expression:

Relational operators are “binary”, so it needs two operands for comparison. Consider the following expression using the less-than operator:

A < B

  • The above expression is called a “relational expression”. It is used to find whether “A” is less than “B”.
  • Relational expression is also referred as “Boolean expression”, because the resultant value of all relational expression is either “True” or “False”. But the states of Boolean values are stored as 0 and 1.
  • Hence, if the resultant value of relational expression is 0, then the expression is “False”. If the resultant value of relational expression is 1, then the expression is “True”.

Evaluating the given relational expression is “true” or “false”:

The below expressions are evaluated using the values that are given:

x=5;

y=6;

z=8;

E)

Program Plan Intro

Relational Operators:

Relational operators are used to compare numeric and character values using the following operators:

  • Greater than (>)
  • Less than (<)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
  • Equal to (==)
  • Not equal to (!=)

These operators will determine whether specific relationship exists between two values of same type.

Relational Expression:

Relational operators are “binary”, so it needs two operands for comparison. Consider the following expression using the less-than operator:

A < B

  • The above expression is called a “relational expression”. It is used to find whether “A” is less than “B”.
  • Relational expression is also referred as “Boolean expression”, because the resultant value of all relational expression is either “True” or “False”. But the states of Boolean values are stored as 0 and 1.
  • Hence, if the resultant value of relational expression is 0, then the expression is “False”. If the resultant value of relational expression is 1, then the expression is “True”.

Evaluating the given relational expression is “true” or “false”:

The below expressions are evaluated using the values that are given:

x=5;

y=6;

z=8;

F)

Program Plan Intro

Relational Operators:

Relational operators are used to compare numeric and character values using the following operators:

  • Greater than (>)
  • Less than (<)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
  • Equal to (==)
  • Not equal to (!=)

These operators will determine whether specific relationship exists between two values of same type.

Relational Expression:

Relational operators are “binary”, so it needs two operands for comparison. Consider the following expression using the less-than operator:

A < B

  • The above expression is called a “relational expression”. It is used to find whether “A” is less than “B”.
  • Relational expression is also referred as “Boolean expression”, because the resultant value of all relational expression is either “True” or “False”. But the states of Boolean values are stored as 0 and 1.
  • Hence, if the resultant value of relational expression is 0, then the expression is “False”. If the resultant value of relational expression is 1, then the expression is “True”.

Evaluating the given relational expression is “true” or “false”:

The below expressions are evaluated using the values that are given:

x=5;

y=6;

z=8;

G)

Program Plan Intro

Relational Operators:

Relational operators are used to compare numeric and character values using the following operators:

  • Greater than (>)
  • Less than (<)
  • Greater than or equal to (>=)
  • Less than or equal to (<=)
  • Equal to (==)
  • Not equal to (!=)

These operators will determine whether specific relationship exists between two values of same type.

Relational Expression:

Relational operators are “binary”, so it needs two operands for comparison. Consider the following expression using the less-than operator:

A < B

  • The above expression is called a “relational expression”. It is used to find whether “A” is less than “B”.
  • Relational expression is also referred as “Boolean expression”, because the resultant value of all relational expression is either “True” or “False”. But the states of Boolean values are stored as 0 and 1.
  • Hence, if the resultant value of relational expression is 0, then the expression is “False”. If the resultant value of relational expression is 1, then the expression is “True”.

Evaluating the given relational expression is “true” or “false”:

The below expressions are evaluated using the values that are given:

x=5;

y=6;

z=8;

Blurred answer
Students have asked these similar questions
1. Give the valid logical expression for this statement: score is between 25 and 45 2. Evaluate the expression below. Give the final result only (True or False). No need to show your solution. T || F && F || (T || T || T) 3. Give the valid relational expression for this statement: input is any number whose one’s digit is 7
1. Give the valid relational expression for this statement: modulo of 15 and number is below value  2. Give the valid relational expression for this statement: count is divisible by 3 .Give the valid logical expression for this statement: either type is 'A' or 'B'. *
Question 8 Question text The arithmetic expression in postfix form can directly be calculated from left to right. -True -False Question 10 Question text The infix expression cannot be calculated directly because they consider the operator precedence. -False -True Question 15 Question text Which of the following is a postfix expression? a) * + A B - C D b) -10 c) A + B * C d) C A B + -

Chapter 4 Solutions

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

Ch. 4.3 - The following code segment is syntactically...Ch. 4.4 - True or false: The following if/else statements...Ch. 4.4 - Write an if/else statement that assigns 1 to x if...Ch. 4.4 - Write an if/else statement that assigns 0.10 to...Ch. 4.5 - If you executed the following code, what would it...Ch. 4.6 - What will the following code display? int funny =...Ch. 4.6 - The following code is used in a bookstore program...Ch. 4.9 - Prob. 4.18CPCh. 4.9 - Assume the variables a = 2, b = 4, and c = 6....Ch. 4.9 - Write an if statement that prints the message The...Ch. 4.9 - Write an if statement that prints the message The...Ch. 4.12 - Prob. 4.22CPCh. 4.12 - Indicate whether each of the following relational...Ch. 4.13 - Rewrite the following if/else statements as...Ch. 4.13 - The following statements use conditional...Ch. 4.13 - Prob. 4.26CPCh. 4.14 - Explain why you cannot convert the following if...Ch. 4.14 - What is wrong with the following switch statement?...Ch. 4.14 - What will the following program display? #include...Ch. 4.14 - Complete the following program skeleton by writing...Ch. 4.14 - Rewrite the following program. Use a switch...Ch. 4 - Describe the difference between the if /else if...Ch. 4 - In an if/else if statement, what is the purpose of...Ch. 4 - What is a flag and how does it work?Ch. 4 - Can an if statement test expressions other than...Ch. 4 - Briefly describe how the operator works.Ch. 4 - Briefly describe how the | | operator works.Ch. 4 - Why are the relational operators called...Ch. 4 - Why do most programmers indent the conditionally...Ch. 4 - An expression using the greater-than, less-than,...Ch. 4 - A relational expression is either ______ or...Ch. 4 - Prob. 11RQECh. 4 - The if statement regards an expression with the...Ch. 4 - The if statement regards an expression with a...Ch. 4 - For an if statement to conditionally execute a...Ch. 4 - In an if/else statement, the if part executes its...Ch. 4 - The trailing else in an if/else if statement has a...Ch. 4 - The if/else if statement is actually a form of the...Ch. 4 - If the subexpression on the left of the _________...Ch. 4 - If the subexpression on the left of the __________...Ch. 4 - The ________ logical operator has higher...Ch. 4 - The logical operators have _________...Ch. 4 - The _________ logical operator works best when...Ch. 4 - The __________ logical operator works best when...Ch. 4 - A variable with _________ scope is only visible...Ch. 4 - Prob. 25RQECh. 4 - An expression using the conditional operator is...Ch. 4 - The expression that is tested by a switch...Ch. 4 - Prob. 28RQECh. 4 - A program will fall through a case section if it...Ch. 4 - What value will be stored in the variable t after...Ch. 4 - Write an if statement that assigns 100 to x when y...Ch. 4 - Write an if/else statement that assigns 0 to x...Ch. 4 - Using the following chart, write an if/else if...Ch. 4 - Write an if statement that sets the variable hours...Ch. 4 - Write nested if statements that perform the...Ch. 4 - Write an if statement that prints the message The...Ch. 4 - Write an if statement that prints the message The...Ch. 4 - Write an if statement that prints the message The...Ch. 4 - Assume str1 and str2 are string objects that have...Ch. 4 - Convert the following if/else if statement into a...Ch. 4 - Match the conditional expression with the if /else...Ch. 4 - T F The = operator and the == operator perform the...Ch. 4 - Prob. 43RQECh. 4 - T F A conditionally executed statement should be...Ch. 4 - T F All lines in a block should be indented one...Ch. 4 - T F Its safe to assume that all uninitialized...Ch. 4 - T F When an if statement is nested in the if part...Ch. 4 - T F When an if statement is nested in the el se...Ch. 4 - T F The scope of a variable is limited to the...Ch. 4 - T F You can use the relational operators to...Ch. 4 - T F x ! = y is the same as (x y || x y)Ch. 4 - T F y x is the same as x = yCh. 4 - T F x = y is the same as (x y x = y)Ch. 4 - T F x == 5 || y 3Ch. 4 - T F 7 = x z 4Ch. 4 - T F 2 != y z != 4Ch. 4 - T F x = 0 || x = yCh. 4 - Each of the following programs has errors. Find as...Ch. 4 - // This program divides a user-supplied number by...Ch. 4 - // This program uses an if/else if statement to...Ch. 4 - // This program uses a switch-case statement to...Ch. 4 - The following statement should determine if x is...Ch. 4 - The following statement should determine if count...Ch. 4 - The following statement should determine if count...Ch. 4 - The following statement should assign 0 to z if a...Ch. 4 - Minimum/Maximum Write a program that asks the user...Ch. 4 - Roman Numeral Converter Write a program that asks...Ch. 4 - Magic Dates The date June 10, 1960 is special...Ch. 4 - Areas of Rectangles The area of a rectangle is the...Ch. 4 - Body Mass Index Write a program that calculates...Ch. 4 - Mass and Weight Scientists measure an objects mass...Ch. 4 - Time Calculator Write a program that asks the user...Ch. 4 - Color Mixer The colors red, blue, and yellow are...Ch. 4 - Change for a Dollar Game Create a change-counting...Ch. 4 - Days in a Month Write a program that asks the user...Ch. 4 - Math Tutor This is a modification of Programming...Ch. 4 - Software Sales A software company sells a package...Ch. 4 - Book Club Points Serendipity Booksellers has a...Ch. 4 - Bank Charges A bank charges 10 per month plus the...Ch. 4 - Shipping Charges The Fast Freight Shipping Company...Ch. 4 - Running the Race Write a program that asks for the...Ch. 4 - Personal Best Write a program that asks for the...Ch. 4 - Fat Gram Calculator Write a program that asks for...Ch. 4 - Spectral Analysis If a scientist knows the...Ch. 4 - Prob. 20PCCh. 4 - The Speed of Sound in Gases When sound travels...Ch. 4 - Freezing and Boiling Points The following table...Ch. 4 - Prob. 23PCCh. 4 - Long-Distance Calls A long-distance carrier...Ch. 4 - Mobile Service Provider A mobile phone service...Ch. 4 - Mobile Service Provider, Part 2 Modify the Program...Ch. 4 - Wi-Fi Diagnostic Tree Figure 4-11 shows a...Ch. 4 - Restaurant Selector You have a group of friends...
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
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT