Starting Out with C++ from Control Structures to Objects (9th Edition)
9th Edition
ISBN: 9780134498379
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 2.6, Problem 2.10CP
Explanation of Solution
Data types:
- The variables use data-type during their declaration.
- The data-type is used to determine the size of memory allocated. Here, the compiler allots the memory.
- All data-type needs different sizes of memory.
Integer data type:
It is a number and it cannot have a fractional part. It may be a positive value, a negative value or zero.
- Integer data type uses 4 bytes of memory...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
c#
Write program that asks to enter an x numbers and sum the even numbers and odd numbers separately then print the sum?
What is a round-off error? Can integer operations cause round-off errors? Can floating-point operations cause round-off errors?
For each of the following equations, perform the following tasks: Decide if the equation is mathematically true for the variable values provided below. Implement the equations in MATLAB, and test if they are true in the floating point arithmetic withinMATLAB for the variable values provided. (For example, the equation 3 + 72 = 5 in matlab would correspond to the command disp(3+7^2==5) and yields, upon execution of the command, the value 0 corresponding to false. This is expectedsince the equation is not mathematically true.) Where the MATLAB result differs from the mathematical expectation explain in one or more full sentences why the MATLAB results are different.
The equations to be considered are, with z = 10^-12, y = 1,1. z^2 + z = z2. z + z^3 = z3. z^3 = 04. -1 + z^2 = -1 - z^25. (z - y)(z + y) = z^2 - y^26. (z - y)(z + y) = z^27. (z - y)(z + y) = -y^2
Chapter 2 Solutions
Starting Out with C++ from Control Structures to Objects (9th 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.8 - Prob. 2.11CPCh. 2.8 - Which of the following is a character literal? B BCh. 2.8 - Prob. 2.13CPCh. 2.8 - Write a program that has the following character...Ch. 2.8 - What is wrong with the following program...Ch. 2.8 - Prob. 2.16CPCh. 2.8 - 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...Ch. 2 - Annual High Temperatures The average July high...Ch. 2 - How Much Paint A particular brand of paint covers...
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
- Assembly (machine) language programs for most computers use __________ notation to represent memory address values.arrow_forwardWrite a assembly language program in which print a to z using array and loop in single line Write a assembly language program in which print a to z using array and loop in separate linearrow_forwardDon't reject if you did not have knowledge. Assembly language. On sim8085 simulatorarrow_forward
- Assembly Language x86: Consider the following variable definitions: var1 SDWORD 12var2 SDWORD 7var3 SDWORD 181var4 SDWORD -50result SDWORD ? Write some assembly code that performs the following arithmetic operations (you don't need to provide the answer): result = (var1 - var2) - (var3 + var4)arrow_forwardIN C PROGRAMMING LANGUAGE AND COMMENT EVERY LINE PLEASE SO I CAN UNDERSTAND EVERY STEP , Write a program that accept two (3 x 3) matrices from the user and then ask the user to select one operation to do: a. Multiplication. b. Addition. c. Subtraction. d. Transpose. The program should print the output as a (3 x 3) matrix.arrow_forwardComputing And Software Systemsarrow_forward
- Problem Set #1 Number Conversions: (Convert all bases to binary first. You can convert the number from binary to any other base) 1.1: Convert 2910 to binary, hexadecimal 1.2: Convert 5810 to binary, hexadecimal Number Conversions: (Convert decimal first. You can convert the number from decimal to any other base) 1.3: Convert E316 to binary, decimal, and octal 1.4: Convert 5916 to binary, decimal 1.5: Convert 438 to binary, decimal, and hexadecimal Number Conversions: 1.6: Convert 010010102 to decimal and hexadecimal 1.7: Convert 001010102 to decimal and hexadecimal Problem Set #2 Binary Addition: Explain the rule of Binary Addition and then solve these problems. Problem 2.1: 01010101 01110101 Problem 2.2: 01011010 11001010 Problem 2.3: 01101101 00010110 Problem 2.4: 01010110 11111001 Problem 2.5: 11010110 10101010 Problem 2.6: 01101101 11111001 Problem Set #3 Binary Subtraction: Explain the rule of Binary Subtraction and then solve these problems. Problem 3.1:…arrow_forwardMIPS Assembly Write a program for RISC MIPS 32bits that challenges a person to guess a number of up to 3 digits before and 3 digits after the comma, that is, a value between 000,000 and 999,999. The program user will try to guess the number with multiple attempts, where the program will indicate at each attempt if the informed number is bigger, smaller, or if the user guessed correctly. When this happens, the program ends, showing a SUCCESS message and a total count of the number of attempts taken to get it right. The program must have a SUBROUTINE as described below. SUBROUTINE:- Input Parameters: user guess, expected value- Output: message on screen (bigger, smaller, SUCCESS)- Returns: value 1 if correct, 0 if incorrectarrow_forwardAIM- Write an 8085 sequence to check whether the first set of reading is higher than the second one or not. PROBLEM STATEMENT- The pressure of two boilers is monitored and controlled by a microcomputer works based on microprocessor programming. A set of 6 readings of first boiler, recorded by six pressure sensors, which are stored in the memory location starting from 2050H. A corresponding set of 6 reading from the second boiler is stored at the memory location starting from 2060H. Each reading from the first set is expected to be higher than the corresponding position in the second set of readings. Write an 8085 sequence to check whether the first set of reading is higher than the second one or not. If all the readings of first set is higher than the second set, store 00 in the 'D' register. If any one of the readings is lower than the corresponding reading of second set, stop the process and store FF in the register 'D'. Data (H): First set: 78, 89, 6A, 80, 90, 85 Second Set:71, 78,…arrow_forward
- C# program. Thank you.arrow_forwardC++ numbering systems. Covert from octal to decimal.arrow_forwardWrite assembly language programs for the 8086 microprocessors to perform multiplication of two matrices Am*n and Bn*p. The value of m = 4, n = 2, and p =3. Assume all the elements in matrices A, B, and answer of the multiplication are 8-bit numbers. Flow chart Pseudocode Assembly Code with brief describe comments (EMU8086 emulator)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningEnhanced Discovering Computers 2017 (Shelly Cashm...Computer ScienceISBN:9781305657458Author:Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. CampbellPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Enhanced Discovering Computers 2017 (Shelly Cashm...
Computer Science
ISBN:9781305657458
Author:Misty E. Vermaat, Susan L. Sebok, Steven M. Freund, Mark Frydenberg, Jennifer T. Campbell
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr