C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. 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
Using C language and using pointers
Create a C++ program for the following cases:
Required:
1. Program Plan
2. Algorithm
3. Flowchart
4. Pseudocode
5. Iteration Table
6. Sample Run
Please help me with this C programming.
Thank you.
Chapter E Solutions
C++ How to Program (10th Edition)
Knowledge Booster
Similar questions
- Q3. A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Given the C code and memory content mapping shown in Figure 4, complete the Table 2 after the program execution. #include ... Ox11223344 a int main() { int a = 2018, b = 2020; ... Ox12345678 int *ptr_a = &a, *ptr_b = &b; OX8899AABB ptr_a *ptr_a = a + 50; *ptr_b = *ptr_b - *ptr_a; OX89ABCDEF ptr_b ptr_b = ptr_a; ..... ... return 0; Figure 4. C code and memory content mapping. Table 2 Variable Value a) |b b) &ptr_a c) ptr_b d) *ptr_barrow_forward10 Computer science subject: C programingarrow_forwardDesign and write a C program that performs the following functionality:1. Prompt the user to enter a vector of maximum 10 digits. Note: the vector entered cancontain spaces.2. Read and store the vector that can contain spaces.3. Use a recursive function to transpose the vector from a row vector to a column vector.4. For example, if the user is prompted and enters the following in the command line(italicized and in red):Enter a vector of maximum 10 digits between 0 and 9: 1 2 3 4 55. Write a recursive function that will produce the following output (in blue):123456. Write and compile your codearrow_forward
- plz help with c++....and keep output same as given and paste indented code plzzarrow_forwardUsing the concept of a pointer to pointer create a c++ program that adds two float values *(*p1)+*(*p2)arrow_forwardPROBLEM 3 Using python, write a function named display_elist() that reads data from the data structures generated by the read_file() function and prints the e-list to the terminal according to the following format. Here is the e-list for Mart 007 ------------------ Welcome ------------------ ============================================= Please select the item you want to buy from the following menu: 1. Spiked Umbrella ($7.25 each), 5 available 2. Voice Changer ($5.5 each), 10 available 3. Spy Camera ($15.0 each), 8 available Press 4 when you are done! =============================================arrow_forward
- 1. Write a pseudocode function in terms of the ADT appointment book, described in Section 1.4.1 of course textbook, for each of the following tasks. Do you need to add operations to the ADT to perform these tasks? a. Change the purpose of the appointment at a given date and time. b Display all the appointments for a given date.arrow_forwardThe concept of referring to the "base address of an array" in the context of a function call pertains to identifying the memory location of the first element of an array. This terminology originates from computer science and programming literature?arrow_forwardPlease the code must be in c program Complete the two functions rotate_right and sudoku_checker according to the specifications given in the associated comments. NOTES: the given starter code includes a display function and a function which reads a board from a file. As given, the main program attempts to read a 9x9 board from an input file given on the command line"arrow_forward
- Solve c++program(see pic)arrow_forward396 Chapter 8▼ The Preprocessor Exercises 1 A program that contains macros with arguments can be difficult to debug. Most C compilers provide an option that causes the preprocessor to write its output on the screen with no further compilation taking place. Put the following code in a file, say try_me.c. #include #define PRN (X) int main(void) { printf("x\n"); PRN (Hello from main()); return 0; BETO } Next, compile the program and run it. You will see that it does not print what was expected. To see how the preprocessor treats this code, give the command cc -E try_me.c (Use redirection if you want to take a careful look at what gets produced.) If the -E option is not the right one for your compiler, find out what the correct option is. Note that the identifier PRN does not get generated by the preprocessor. Explain why. Fix the code. Hint: Use stringization.arrow_forwardIntroduction to Macros in MarsRead about macros here:https://courses.missouristate.edu/kenvollmar/mars/help/MacrosHelp.htmlLab TasksIn the above tutorial on macros, a simple for loop has been implemented using macros. As you can see, it is a powerful tool to simulate code that looks like a statement in a high-level language. The for loop in the tutorial prints a range of consecutive numbers. Copy the code from the tutorial to Mars and make it execute. The macro call: for ($t0, 1, 10, body) will lead to printing numbers from 1 to 10, one each in a new line. Your task is to modify the code to pass another argument (an interval) to the macro so that the numbers are printed with the given interval in the same line where a space separates the numbers. Your program will also print a string (“Here is the output: ”) before the series of numbers using the print_str macro. For example, Macro call: for ($t0, 1, 20, 3, body) will produce the following output: Here is the output: 1 4 7 10 13 16…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning