Define a function called add_func() that takes two arguments. The function should adds the two arguments together using + and return the output. For example, if the input values for the arguments are 1 and 2, then 3 should be returned. Likewise, if the input arguments are "good" and " day", then "good day" should be returned

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 19PE
icon
Related questions
Question

Complete the following TODO by defining a function called add_func().

  1. Define a function called add_func() that takes two arguments. The function should adds the two arguments together using + and return the output. For example, if the input values for the arguments are 1 and 2, then 3 should be returned. Likewise, if the input arguments are "good" and " day", then "good day" should be returned.
# TODO 


print(f"add_func output for 1 + 2: {add_func(1, 2)}")
print(f"add_func output for good + day: {add_func('good',' day')}")

todo_check([
(add_func(1,2) == 3,'add_func() did not return 3 when using input values 1 and 2.'),
(add_func('good',' day') == "good day",'add_func() did not return "good day" when using input values "good" and " day"')
])
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning