Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this exercise, you will experiment with passing variables by value and by reference. ( The answers to TRY THIS Exercises are located at the

In this exercise, you will experiment with passing variables by value and by reference. (The answers to TRY THIS Exercises are located at the end of the chapter.)a. Follow the instructions for starting C++ and viewing the TryThis9.cpp file, which is contained in either the Cpp8\Chap10\TryThis9 Project folder or the Cpp8\Chap10 folder. (Depending on your C++ development tool, you may need to open this exercises project/solution file first.) b. Notice that the main function passes the age variable by value to the getAge function. Run the program. When prompted to enter your age, type your age and press Enter. The message that appears should contain your age; however, it contains the number 0 instead. This is because the age variable is passed by value to the getAge function.c. Modify the program so that it passes the age variable by reference to the getAge function. Save and then run the program. When prompted to enter your age, type your age and press Enter. This time, the message contains your age.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

Apply writing principles to business materials

Answered: 1 week ago

Question

How do we organise for international logistics?

Answered: 1 week ago

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago