Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ please add comments This lab will do more with functions, focusing on reference parameters 1) The provided reorder.cpp file has some code for a

c++ please add comments image text in transcribed
image text in transcribed
This lab will do more with functions, focusing on reference parameters 1) The provided reorder.cpp file has some code for a function that reorders the values in 3 parameters so that they are in ascending order. Start with a function void swap (int &vali, int &val2) that swaps the values of vall and val2. You will need a local variable to hold the value of one of the parameters to let you do this. Write the reorder function called in main(). It should call swap () to exchange values when appropriate. . Add statements to main() to be able to try out the 3 cases below Driver to test reorder() Case 1: values are already in correct order -- leave them alone 1 2 3 Case 2: first > second and first second > third 6 8 10 // Code for lab 5 // Reordering values in variables #include using namespace std; 1/ swap the values in the two reference integer parameters void swap(int &vali, int &val2) { 11 reorder 3 integer values so that // first parameter has smallest value, second parameter has middle value, // third parameter has largest value int main() int vall = 1, val2 = 2, val3 = 3; cout

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

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

2. Are my sources up to date?

Answered: 1 week ago