C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
10th Edition
ISBN: 9780134448848
Author: Paul Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter E, Problem E.12E
Program Plan Intro
#define SQR(x) x* x:
when preprocessor expands this macros it will produce the square of the suppiled number correctely and will not give any error.
#define SQR(x) (x*x):
when preprocessor expands this macros it will produce the square of the suppiled number correctely and will not give any error.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
3. Explain the following with respect to 8086 Microprocessor.a. Procedures with exampleb. Different types of procedures.c. Macros with exampled. Difference between macros and Procedures.
i need complete code and simulate it in emu8086
Write a valid assembly macro that takes one operand named number and prints the smallest positive integer n for which 1+2+3+. . . +n is at least equal to number. Use the macro in a complete valid code. Note: the result can be 2-digit number.
Please I need a new solution ( dont give me the same solution)
Write the code in data segment and code segment to simulate it.
Complete code please
Write an assembly MACRO that takes an integer number as parameter. Keep dividing the number by 10 until it reaches zero. Then compute the percentage of even digits in that number. ( Example if num=73458Ã then the percentage is = 2/5=0.4)
Chapter E Solutions
C++ How To Program (Early Objects Version), Global Edition, With Access Card, 10 Ed
Knowledge Booster
Similar questions
- How to write a function (count) in assembly language to perform the following task. Generate a counter (let's say 20,000) using the function. The function should have one integer argument (in this example, 20,000). Calculate the execution time of code by using the time command and redirect the output to the counter_fun.txt file. Append the counter in an already created text file (counter_fun.txt). How to write a function in assembly language that uses recursion to generate the same counter and that performs the following tasks. Use the same function (count), but will repeatedly call the same function (recursion) to generate the counter. Calculate the execution time of code by using the time command and redirect the output to the counter_rec.txt file. Append the counter in an already created text file (counter_rec.txt). If we compare both the time, which code (function or recursion) runs efficiently and why.arrow_forwardSuppose the following MACRO is defined: something MACRO val1, val2 mov EAX, val1 and EAX, val2ENDM Now suppose a procedure calls this macro using the following instruction: something EBX, num2 Write the macro expansion.arrow_forwardGive an example for this macros to explain its work: The Code is Carrow_forward
- Course: Assembly Language Question: Write a POWER MACRO N, which takes the number in AX and raises it to thepower of N, where N is a positive number. The result should be stored in AX.arrow_forwardHow to write a function (count) in assembly language to perform the following task. Generate a counter (let's say 20,000) using the function. The function should have one integer argument (in this example, 20,000). Calculate the execution time of code by using the time command and redirect the output to the counter_fun.txt file. Append the counter in an already created text file (counter_fun.txt).arrow_forwardTranslate the following C code to MIPS compiler code. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. Assume 4-byte  1.) B[8] = I + J 2.) H = I – J 3.) A[4] = F + G + H 4.) A[0] = G + H + A[4] – 4arrow_forward
- Assume that there are two 7-segment LED displays connected to port B of a PPI (8255)at address 0770H. The displays are connected to the PPI through 7 Segment Display drivers asshown below.a) Write a macro, DIGITDISPLAY, that receives the packed BCD number as its input argumentand displays the two-digit number on the given 7 segment displays.b) Write an assembly language program that uses the macro given in (a) to display thenumbers, from 00 to 99 and then from 99 to 00 continuously in an infinite loop. The two-digitcounter is incremented/decremented at every 0.5 seconds.arrow_forwardWrite the statements generated by the following macro:FOR val,<100,20,30>BYTE 0,0,0,valENDMarrow_forwardWrite an assembly language program with the following functionality    Prompts the user to enter two digits (each less than five)    Gets the sum of the two digits   Prints out the sum on the screen Note: use a macros for all the outputs and inputsarrow_forward
- 1a. 1B.explain the logic of why this code produces this output  #include <stdio.h>main( ){int a=3,b,d=12; float c,f=7.2; b=a++ * 2; printf("%d %d\n",a,b); b=++a *2; printf("%d %d\n",a,b); c = f+d/10 ; f += d%8; printf("%f %f\n",c,f);}output:4 65 108.200000 11.200000  1B.)explain the logic of this problem Write the necessary preprocessor macro(s) to convert from radians to degrees.#define PI 3.141592653589793238462643383279502884197#define rtd(x) (180.0*(x)/PI)arrow_forwardUse the C programming language to write code that proclaims and sets a double, int, and char. Afterward, proclaim and set a pointer to the double, int, and char. The code must print the inscription of, and value stored in, and the memory size (in bytes) of all six variables. The "0x%x" formatting specifier outputs inscriptions in hexadecimal. SAMPLE OUTPUT: Char ___ 's inscription is 0x___Int ___'s inscription is 0x___Double ___'s inscription is 0x___Char* ___'s inscription is 0x___Int* ___'s inscription is 0x___Double* ___'s inscription is 0x___Char ___ 's value is ___Int ___'s value is ___Double ___'s value is ___Char* ___'s value is 0x___Int* ___'s value is 0x___Double* ___'s value is 0x___Char ___ 's size is ___ bytesInt ___'s size is ___ bytesDouble ___'s size is ___ bytesChar* ___'s size is ___ bytesInt* ___'s size is ___ bytesDouble* ___'s size is ___ bytesarrow_forwardThis is a MASM Project Assembly Code for x86 Processors ! Which statement is true of macros? Group of answer choices:  A: If they aren't invoked, macros take up unnecessary space  B: Macros are placed at the end of the .code segment  C: Macros can't be placed in other macros  D: Macros are much harder to debug than proceduresarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education