Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve all the question and parts in the two pictures by showing all your work and steps. Do not skip any of them, do them
Solve all the question and parts in the two pictures by showing all your work and steps. Do not skip any of them, do them all to get a thumbs up! First picture answer number 1,2, and 3. second picture answer from part a to d.
Objective The objective of this tutorial is to familiarize yourself with C++ variables, numerical data types, and operations performed on them. First, we will wrap up number systems with negative numbers which describes how signed numbers are stored in binary. In this tutorial, you will discover how to store literal values in variables and how programs evaluate arithmetic expressions on them. This will then be applied to C++ programs requiring mathematical expressions. Negative Numbers The 2's Compliment is used to represent negative numbers in Binary. Find the 2's Compliment for the following integers assuming 8-bits of memory: 1) 010010112 2) - 12010 3) 101101012 Numerical Data Types C++ offers a variety of data types available to the programmer such as numbers. Numerical data types can be represented in two ways: Literal Constant Variables Before a variable can be used, it must be first defined by the programmer. It must also be initialized but this doesn't have to occur at the definition. A variable is defined through assigning it a type and a name. Variable names must abide by the following rules: Numerical Operations Mathematical operations can be performed on both literal constants and variables. Arithmetic operations must be performed on data of the same types. If the types are different, they must either be casted implicitly or explicitly. Implicit casting is done by the compiler while explicit casting is done by the programmer. Examples What is the value assigned to each of the variables after executing the following statements? a) int a (27), b(6), ; c = ba; b) int a (27), b(6); double c; c = a 1 (double) b; c) int a; double b(6), C(18.6); a=c/b; d) int b = 6; double a, c(18.6; (int) 0 / bStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started