In this lab, you complete a partially written C++ program that includes a function named addNumbers () that adds three int values to find their sum. Four ints should be passed to the addNumbers () function, the three numbers to be added ( num1, num2, and num3) should be passed by value, and another int ( sum ) to hold the sum of the three numbers should be passed by reference, enabling the addNumbers () function to change its value. The source code file provided for this lab includes the necessary variable declarations and input and output statements. Comments are included in the file to help you write the remainder of the program. 1. Open the source code file named AddThree.cpp using Notepad or the text editor of your choice. 2. Write the addNumbers ) function, the function declaration, and the function call as indicated by the comments. 3. Save this source code file in a directory of your choice, and then make that directory your working directory. 4. Compile the source code file AddThree.cpp. 5. Execute the program. 6. Rewrite the addNumbers ) function to pass the three numbers ( numl, num2, and num3) by value and to pass sum by address. 7. Save this program as AddThree2.cpp. 8. Compile AddThree2.cpp. 9. Execute the program. Both programs (AddThree.cpp and AddThree2 .cpp) should generate the same output.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

In this lab, you complete a partially written C++ program that includes a function named addNumbers () that adds three int values to find their sum. Four ints should be passed to the addNumbers () function, the three numbers to be added ( num1, num2, and num3) should be passed by value, and another int ( sum ) to hold the sum of the three numbers should be passed by reference, enabling the addNumbers () function to change its value. The source code file provided for this lab includes the necessary variable declarations and input and output statements. Comments are included in the file to help you write the remainder of the program.

1. Open the source code file named AddThree.cpp using Notepad or the text editor of

your choice.

2. Write the addNumbers ) function, the function declaration, and the function call as

indicated by the comments.

3. Save this source code file in a directory of your choice, and then make that directory

your working directory.

4. Compile the source code file AddThree.cpp.

5. Execute the program.

6. Rewrite the addNumbers ) function to pass the three numbers ( numl, num2, and num3)

by value and to pass sum by address.

7. Save this program as AddThree2.cpp.

8. Compile AddThree2.cpp.

9. Execute the program. Both programs (AddThree.cpp and AddThree2 .cpp) should generate the same output.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY