1 Introduction To Computers And Programming 2 Introduction To C++ 3 Expressions And Lnteractivity 4 Making Decisions 5 Loops And Files 6 Functions 7 Arrays 8 Searching And Sorting Arrays 9 Pointers 10 Characters, C-strings, And More About The String Class 11 Structured Data 12 Advanced File Operations 13 Introduction To Classes 14 More About Classes 15 Inheritance, Polymorphism, And Virtual Functions 16 Exceptions, Templates And The Standard Template Library (stl) 17 Linked Lists 18 Stacks And Queues 19 Recursion 20 Binary Trees expand_more
4.1 Relational Operators 4.2 The If Statement 4.3 Expanding The If Statement 4.4 The If/else Statement 4.5 Nested If Statements 4.6 The If/else If Statement 4.7 Flags 4.8 Logical Operators 4.9 Checking Numeric Ranges With Logical Operators 4.10 Menus 4.11 Focus On Software Engineering: Validating User Input 4.12 Comparing Characters And Strings 4.13 The Conditional Operator 4.14 The Switch Statement 4.15 More About Blocks And Variable Scope Chapter Questions expand_more
Problem 1RQE: Describe the difference between the if /else if statement and a series of if statements. Problem 2RQE: In an if/else if statement, what is the purpose of a trailing else? Problem 3RQE: What is a flag and how does it work? Problem 4RQE: Can an if statement test expressions other than relational expressions? Explain. Problem 5RQE: Briefly describe how the operator works. Problem 6RQE: Briefly describe how the | | operator works. Problem 7RQE: Why are the relational operators called relational? Problem 8RQE: Why do most programmers indent the conditionally executed statements in a decision structure? Problem 9RQE: An expression using the greater-than, less-than, greater-than-or-equal-to, less-than-or equal-to,... Problem 10RQE: A relational expression is either ______ or _________. Problem 11RQE Problem 12RQE: The if statement regards an expression with the value 0 as _________. Problem 13RQE: The if statement regards an expression with a nonzero value as _________. Problem 14RQE: For an if statement to conditionally execute a group of statements, the statements must be enclosed... Problem 15RQE: In an if/else statement, the if part executes its statement or block if the expression is... Problem 16RQE: The trailing else in an if/else if statement has a similar purpose as the _______ section of a... Problem 17RQE: The if/else if statement is actually a form of the _________ if statement. Problem 18RQE: If the subexpression on the left of the _________ logical operator is false, the right subexpression... Problem 19RQE: If the subexpression on the left of the __________ logical operator is true, the right subexpression... Problem 20RQE: The ________ logical operator has higher precedence than the other logical operators. Problem 21RQE: The logical operators have _________ associativity. Problem 22RQE: The _________ logical operator works best when testing a number to determine if it is within a... Problem 23RQE: The __________ logical operator works best when testing a number to determine if it is outside a... Problem 24RQE: A variable with _________ scope is only visible when the program is executing in the block... Problem 25RQE Problem 26RQE: An expression using the conditional operator is called a(n) ________ expression. Problem 27RQE: The expression that is tested by a switch statement must have a(n) _________ value. Problem 28RQE Problem 29RQE: A program will fall through a case section if it is missing the _____ statement. Problem 30RQE: What value will be stored in the variable t after each of the following statements executes? A) t =... Problem 31RQE: Write an if statement that assigns 100 to x when y is equal to 0. Problem 32RQE: Write an if/else statement that assigns 0 to x when y is equal to 10. Otherwise, it should assign 1... Problem 33RQE: Using the following chart, write an if/else if statement that assigns .10, .15, or .20 to... Problem 34RQE: Write an if statement that sets the variable hours to 10 when the flag variable minimum is set. Problem 35RQE: Write nested if statements that perform the following tests: If amount 1 is greater than 10 and... Problem 36RQE: Write an if statement that prints the message The number is valid if the variable grade is within... Problem 37RQE: Write an if statement that prints the message The number is valid if the variable temperature is... Problem 38RQE: Write an if statement that prints the message The number is not valid if the variable hours is... Problem 39RQE: Assume str1 and str2 are string objects that have been initialized with different values. Write an... Problem 40RQE: Convert the following if/else if statement into a switch statement: if (choice == 1) { cout fixed ... Problem 41RQE: Match the conditional expression with the if /else statement that performs the same operation. A) q... Problem 42RQE: T F The = operator and the == operator perform the same operation when used in a Boolean expression. Problem 43RQE Problem 44RQE: T F A conditionally executed statement should be indented one level from the if statement. Problem 45RQE: T F All lines in a block should be indented one level. Problem 46RQE: T F Its safe to assume that all uninitialized variables automatically start with 0 as their value. Problem 47RQE: T F When an if statement is nested in the if part of another statement, the only time the inner if... Problem 48RQE: T F When an if statement is nested in the el se part of another statement, as in an if / else if,... Problem 49RQE: T F The scope of a variable is limited to the block in which it is defined. Problem 50RQE: T F You can use the relational operators to compare string objects. Problem 51RQE: T F x ! = y is the same as (x y || x y) Problem 52RQE: T F y x is the same as x = y Problem 53RQE: T F x = y is the same as (x y x = y) Problem 54RQE: T F x == 5 || y 3 Problem 55RQE: T F 7 = x z 4 Problem 56RQE: T F 2 != y z != 4 Problem 57RQE: T F x = 0 || x = y Problem 58RQE: Each of the following programs has errors. Find as many as you can. 58. // This program averages 3... Problem 59RQE: // This program divides a user-supplied number by // user-supplied number. It checks for division by... Problem 60RQE: // This program uses an if/else if statement to assign a // letter grade (A, B, C, D, or F) to a... Problem 61RQE: // This program uses a switch-case statement to assign a // letter grade (A, B, C, D, or F) to a... Problem 62RQE: The following statement should determine if x is not greater than 20. What is wrong with it? if (!x ... Problem 63RQE: The following statement should determine if count is within the range of 0 through 100. What is... Problem 64RQE: The following statement should determine if count is outside the range of 0 through 100. What is... Problem 65RQE: The following statement should assign 0 to z if a is less than 10, otherwise it should assign 7 to... Problem 1PC: Minimum/Maximum Write a program that asks the user to enter two numbers. The program should use the... Problem 2PC: Roman Numeral Converter Write a program that asks the user to enter a number within the range of 1... Problem 3PC: Magic Dates The date June 10, 1960 is special because when we write it in the following format, the... Problem 4PC: Areas of Rectangles The area of a rectangle is the rectangles length times its width. Write a... Problem 5PC: Body Mass Index Write a program that calculates and displays a persons body mass index (BMI). The... Problem 6PC: Mass and Weight Scientists measure an objects mass in kilograms and its weight in newtons. If you... Problem 7PC: Time Calculator Write a program that asks the user to enter a number of seconds. There are 60... Problem 8PC: Color Mixer The colors red, blue, and yellow are known as primary colors because they cannot be made... Problem 9PC: Change for a Dollar Game Create a change-counting game that gets the user to enter the number of... Problem 10PC: Days in a Month Write a program that asks the user toenterthe month(letting the user enter an... Problem 11PC: Math Tutor This is a modification of Programming Challenge 17 from Chapter 3. Write a program that... Problem 12PC: Software Sales A software company sells a package that retails for 99. Quantity discounts are given... Problem 13PC: Book Club Points Serendipity Booksellers has a hook club that awards points to its customers based... Problem 14PC: Bank Charges A bank charges 10 per month plus the following check fees for a commercial checking... Problem 15PC: Shipping Charges The Fast Freight Shipping Company charges the following rates: Weight of Package... Problem 16PC: Running the Race Write a program that asks for the names of three runners and the time it took each... Problem 17PC: Personal Best Write a program that asks for the name of a pole vaulter and the dates and vault... Problem 18PC: Fat Gram Calculator Write a program that asks for the number of calories and fat grams in a food.... Problem 19PC: Spectral Analysis If a scientist knows the wavelength of an electromagnetic wave, he or she can... Problem 20PC Problem 21PC: The Speed of Sound in Gases When sound travels through a gas, its speed depends primarily on the... Problem 22PC: Freezing and Boiling Points The following table lists the freezing and boiling points of several... Problem 23PC Problem 24PC: Long-Distance Calls A long-distance carrier charges the following rates for telephone calls:... Problem 25PC: 25. Mobile Service Provider
A mobile phone service provider has three different subscription... Problem 26PC: 26. Mobile Service Provider, Part 2
Modify the Program in Programming Challenge 25 so that it also... Problem 27PC format_list_bulleted