Starting Out with C++ from Control Structures to Objects (8th Edition)
8th Edition
ISBN: 9780133769395
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2, Problem 19RQE
The negation operator is ________.
A) unary
B) binary
C) ternary
D) none of the above
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule03:10
Students have asked these similar questions
Logical operators have __________ precedence than relational operators.
The equal sign in an assignment statement is called the_________ .
✓ Allowed languages
C
Problem Statement
Create a program that will determine whether a triple can
generate a triangle and if it can generate a triangle, determine if
the triangle is scalane, isosceles or equilateral.
Input
Input starts with a number N and is followed by N triples (a,b,c),
where a, b and c are natural numbers
Output
The output will be: equilateral, if the triangle formed is an
equilateral triangle, isosceles, if the triangle formed is isosceles
and scalene if the triangle formed is scalene. Output no triangle
is formed, if no triangle can be formed.
Limits
1 < N < 20
1 \le input \le 100~
Notes
Problems will have test cases that are not listed in their
specification. Your solution must produce the right output for
these hidden test cases.
Sample Input #1
4
2 2 3
222
1 1 2
2 3 4
Sample Output #1
isosceles
equilateral
no triangle is formed
scalene
Copy
Copy
Chapter 2 Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Ch. 2.1 - The following C++ program will not compile because...Ch. 2.3 - The following C++ program will not compile because...Ch. 2.3 - Study the following program and show what it will...Ch. 2.3 - Write a program that will display your name on the...Ch. 2.4 - Prob. 2.5CPCh. 2.4 - What will the following program display on the...Ch. 2.6 - Which of the following are illegal variable names,...Ch. 2.6 - Prob. 2.8CPCh. 2.6 - Prob. 2.9CPCh. 2.6 - Prob. 2.10CP
Ch. 2.7 - Prob. 2.11CPCh. 2.7 - Which of the following is a character literal? B BCh. 2.7 - Prob. 2.13CPCh. 2.7 - Write a program that has the following character...Ch. 2.7 - What is wrong with the following program...Ch. 2.7 - Prob. 2.16CPCh. 2.7 - Write a program that stores your name, address,...Ch. 2.11 - Prob. 2.18CPCh. 2.11 - Prob. 2.19CPCh. 2.11 - Prob. 2.20CPCh. 2.14 - Is the following assignment statement valid or...Ch. 2.14 - How would you consolidate the following...Ch. 2.14 - What is wrong with the following program? How...Ch. 2.14 - Prob. 2.24CPCh. 2.16 - Prob. 2.25CPCh. 2 - How many operands does each of the following types...Ch. 2 - How may the double variables temp, weight, and age...Ch. 2 - Prob. 3RQECh. 2 - Write assignment statements that perform the...Ch. 2 - Is the following comment written using single-line...Ch. 2 - Is the following comment written using single-line...Ch. 2 - Modify the following program so it prints two...Ch. 2 - What will the following programs print on the...Ch. 2 - Multiple Choice 9. Every complete statement ends...Ch. 2 - Prob. 10RQECh. 2 - Every C++ program must have a ________. A) cout...Ch. 2 - Preprocessor directives begin with ________. A) #...Ch. 2 - The following data 72 'A' Hello World" 2.8712 are...Ch. 2 - A group of statements, such as the contents of a...Ch. 2 - Which of the following are not valid assignment...Ch. 2 - Which of the following are not valid cout...Ch. 2 - Assume w = 5, x = 4, y = 8, and z = 2. What value...Ch. 2 - How would each of the following numbers be...Ch. 2 - The negation operator is ________. A) unary B)...Ch. 2 - A(n) ___________ is like a variable, but its value...Ch. 2 - Prob. 21RQECh. 2 - T F A variable must be defined before it can be...Ch. 2 - T F Variable names may begin with a number.Ch. 2 - T F Variable names may be up to 31 characters...Ch. 2 - T F A left brace in a C++ program should always be...Ch. 2 - T F You cannot initialize a named constant that is...Ch. 2 - Prob. 27RQECh. 2 - Convert the following pseudocode to C++ code. Be...Ch. 2 - There are a number of syntax errors in the...Ch. 2 - Sum of Two Numbers Write a program that stores the...Ch. 2 - Sales Prediction The East Coast sales division of...Ch. 2 - Sales Tax Write a program that will compute the...Ch. 2 - Restaurant Bill Write a program that computes the...Ch. 2 - Average of Values To get the average of a series...Ch. 2 - Annual Pay Suppose an employee gets paid every two...Ch. 2 - Ocean Levels Assuming the oceans level is...Ch. 2 - Total Purchase A customer in a store is purchasing...Ch. 2 - Cyborg Data Type Sizes You have been given a job...Ch. 2 - Miles per Gallon A car holds 15 gallons of...Ch. 2 - Distance per Tank of Gas A car with a 20-gallon...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Circuit Board Price An electronics company sells...Ch. 2 - Prob. 14PCCh. 2 - Triangle Pattern Write a program that displays the...Ch. 2 - Diamond Pattern Write a program that displays the...Ch. 2 - Stock Commission Kathryn bought 750 shares of...Ch. 2 - Energy Drink Consumption A soft drink company...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
The for loop is this type of loop. a. pretest b. posttest c. prefix d. postfix
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
In what way is a class more general than a traditional abstract data type?
Computer Science: An Overview (12th Edition)
This is automatically provided for a class if you do not write one yourself. a. accessor method b. default inst...
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Explain why incremental development is the most effective approach for developing business software systems. Wh...
Software Engineering (10th Edition)
If the new operator cannot allocate the amount of memory requested, it throws ______.
Starting Out with C++: Early Objects
What is the disadvantage of having too many features in a language?
Concepts of Programming Languages (11th Edition)
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
- 4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }arrow_forwardC programringarrow_forwardThe _________ function returns true if the character argument is uppercase.arrow_forward
- If the new operator cannot allocate the amount of memory requested, it throws_____________arrow_forwardThe logical operators have a higher precedence than the ____ operator(s). a. exponentiation b. arithmetic negation c. comparison d. assignmentarrow_forwardE TE' E' +TE/E T FT' T' *FT'/E F (E)/id.arrow_forward
- 19 20 def my_and (a: bool, b: bool) -> bool: 21 22 Return True if and are both True, ONLY using 'not' and 'or'. 23 This means you CANNOT use operators like ==, bool(), and *, +, etc. 24 >>> my_and (True, False) 25 False 26 >>> my_and (True, True) 27 True 28arrow_forwardCPSC 130: Introduction to Computer Programming I Program 3: Decisions In this programming assignment, you will implement two Java programs that deal with decisions. Part1: Determine correct quadrant for angle Complete the program below so that it prompts the user for an angle in degrees, and prints out the quadrant in which the angle is located, represented by Roman numerals, as shown in the following figure. 180⁰ II E III 90⁰ 270⁰ IV Notice that the value of the angle starts at zero degrees at the rightmost point of the circle, moving counterclockwise around the circle as the number of degrees grows. For instance, if the input angle has 100 degrees, it is in quadrant II, while an angle of 300 degrees is in quadrant IV and an angle of 45 degrees is in quadrant I. Each quadrant contains 90 degrees and starts at a multiple of 90. For example, 89 degrees is in quadrant I and 90 degrees is in quadrant II. All the input angle values must be integers between 0 and 359. If the value of an…arrow_forwardC# language no lopping use decision making and condtional operatorarrow_forward
- بايثونarrow_forwardLad ℗ Ⓒ Understanding Nested if Statements Summary In this lab, you complete a prewritten Java program that calculates an employee's productivity bonus and prints the employee's name and bonus. Bonuses are calculated based on an employee's productivity score as shown below. A productivity score is calculated by first dividing an employee's transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked. Instructions Productivity Score Bonus <30 31-69 70-199 ≥ 200 1. Ensure the file named EmployeeBonus.java is open. 2. Variables have been declared for you, and the input statements and output statements have been written. Read them over carefully before you proceed to the next step. $50 $75 $100 $200 3. Design the logic, and write the rest of the program using a nested if statement. 4. Execute the program by clicking Run and enter the following as input: Employee's first name: Kim Smith Number of shifts: 25 Number of transactions: 75…arrow_forwardYou can use a __________ to explicitly convert a value from one numeric data type to another, even if the conversion might result in a loss of data. a. transpose statement b. cast operator c. conversion operator d. literal conversionarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Python Tutorial #10; Math Functions in Python; Author: Art of Engineer;https://www.youtube.com/watch?v=OviXsGf4qmY;License: Standard YouTube License, CC-BY