Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Question
Chapter 12, Problem 3E
Program Plan Intro
- Include the necessary header files into program.
- Define the macro named “MIN()” to find out the minimum of two values.
- Define the main function
- Declare the variable “x” and “y” in type of integer.
- Prompt and get the value of “x” and “y” from user.
- Call the macro “MIN()” in print function which passes “x” and “y” as argument and print the resultant value.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Set a macro with symbol ABOUTME with your Student ID and Full Name in the replacement string.
Write an assembly program that has a macro maximum that finds the larger of two numbers inputted by the user. please show screenshot of output too
The Problem: Parameterized macros can cause unexpected things to happen. Consider the following case:#define SQUARE(x) ((x) * (x))int i = 5;int j = SQUARE(i++);What's the value of j? The answer is that it's compiler dependent. And the value of i is definitely not 6. Why? Just look at the code after the macro is expanded:int j = ((i++) * (i++));From this we can see that i is increment twice. Also since the order of the operations is not specified by the C++ standard, the actual value of j is compiler dependent.
Knowledge Booster
Similar questions
- In the study of assemblers what is a macro command? What is an example of macro command? When we should program a function, and when we should program a macro command?arrow_forwardWhich of the following commands stops a macro from developing to its full potential?arrow_forwardWhich directive stops all further expansion of a macro?arrow_forward
- Write a macro in VBA to approximate the value of the function f(x) = tan (x) at some nonzero point x in radians, using a Maclaurin series through the second derivative term (MLO 3.3). Allow the point x to be input using the InputBox() command. Calculate (a) an upper bound for the remainder term Rn , (b) the exact value of the function at x , (c) the true error Et and the true relative error (MLO 3.2) Output all these values to a blank Excel sheet, and include proper labels! Neatness counts!arrow_forwardIt is desired to write a #define macro to compute the product of two numbers. What is the correct macro? Group of answer choices #define multiply (return(a*b)) #define multiply(a,b) (a*b) #define multiply(a,b) (int a*int b) #define multiply (int a, b; return(a*b)) ============= What does the function fopen return? Group of answer choices an integer a FILE pointer it returns nothing the contents of the file it is opening =============== Consider the following code fragment: int main (int argc, char* argv[]) { cout<<argc; return 0; } The code is compiled and executed from the terminal as: .\a.out What will be the output? Group of answer choices 0 1 argc -1arrow_forwardQuestion on Preprocessor (Programming in C, by Kochan) Consider the definition of the printint macro:#define printint(n) printf ("%i\n", x ## n) Could this macro be used to display the values of the 100 variables x1–x100: for (i = 1; i < 100; ++i) printint (i); I've tried various definitions for the macro and none of them work. Am I right to assume there is no way to get the following loop in main() to print x1–x100 variables (ie adding x to i) using such (or any other) #define macro?arrow_forward
- Computer Science Write a VBA program that replaces all instances of Oklahoma State University in provided text with the words Rose State College. NOTE: some students have had issues sending Word files with macros, so please include a screenshot of the macroarrow_forwardExercisesGive an example for each of these macros to explain its work: Macro: int WIFSIGNALED (int status)This macro returns a nonzero value if the child process terminated because it received a signal thatwas not handled. Macro: int WTERMSIG (int status)If WIFSIGNALED is true of status, this macro returns the signal number of the signal thatterminated the child process. Macro: int WCOREDUMP (int status)This macro returns a nonzero value if the child process terminated and produced a core dump. Macro: int WIFSTOPPED (int status)This macro returns a nonzero value if the child process is stopped. Macro: int WSTOPSIG (int status)If WIFSTOPPED is true of status, this macro returns the signal number of the signal that causedthe child process to stop. take screen shot for code and output in ubuntu kaliarrow_forwardWrite a MACRO that performs CHECKSUM test of a given data. It takes two parameters, DATABYTES array and its LENGTH. For example, LENGTH is 5 and DATABYTES is 25h, 62h, 3Fh, 52h, E8h the last byte (E8h) is CHECKSUM byte. Your macro will move 01h to DX if the checksum test passes, otherwise DX is reset (00h) CHECKSUMTEST MACRO DATABYTES, LENGTH .... ENDMarrow_forward
- Implement a system of three concurrent processes which read and write sequence numbers to a file. Each of the three processes must obtain 200 integers from the file. The file only holds one integer at a given time. Given a file, F, containing a single integer, each process must perform the following steps: Please show steps and answer.arrow_forwardDiscuss the concept of mouse macros and how they can be created and utilized for complex tasks in Windows. Provide an example of a practical application.arrow_forwardSegmentation supports a “user view” of memory allocation for a process. True or false?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage