Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please answer all questions and explain. (programming in c) Problem 6. Chapter 5.5, Exercise 3. 3. What is the error? int schedule(char activity ) int
please answer all questions and explain. (programming in c)
Problem 6. Chapter 5.5, Exercise 3. 3. What is the error? int schedule(char activity ) int i; float time; int activity; Problem 7. Programming Exercises 5.7. Write a short function power that expects two arguments, x and n, and returns x to the power n. The argument x is of type double, and n is of type int. Problem 8. 5.2. Write a program that prompts the user for two integers and one of the letter codes a, s, m, or d. The interpretation is given by the following table: Letter Meaning add subtract multiply divide The function main issues the prompt and stores the user's input in the variables num, num2, and operator. Then main checks the letter code. If the letter code is a, main invokes the function add with arguments num and num2 and similarly for s, m, and d. Each of the functions add, subtract, multiply, and divide invokes the function print_result, which prints the result of the arithmetic operation. Problem 9. Section 5.6, Exercise 13. 13. The following are two definitions for a macro that picks the maximum of two num- bers. Which is better, and why? Give an example to illustrate your preference. #define MAX1 ( numi, num2) (numi > num2 ? numi : num 2 ) #define MAX2( num1, num2) ((numi) > (num2) ? (numi): (num2)) Problem 10. Section 5.6, Exercise 15. 15. What is the error in the following attempt to define a parameterized macro maxStep 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