{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# E s e d the fore all thre value arepasse by re re and

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: stNbr; "; cout << "Second integer: "; cin >> secondNbr; cout << "Third integer: cin >> thirdNbr; } "; Thethre param te he aresuppose to obtain ne value in this e e rs re d w s function, and thosethre value arene de in thecalling function. e s e d The fore all thre value arepasse by re re , and any change re , e s d fe nce s m to the in this function autom ade m atically affe x, y, and z ct in main. CS 140 Chapter 4 Page 5 void reorderThreeNumbers(int &nbrA, int &nbrB, int &nbrC) { int temp; if ((nbrB <= nbrA) && (nbrB <= nbrC)) { This function re rs thethre value orde e s temp = nbrA; so the bein num rical orde whe y'll e r n nbrA = nbrB; nbrB = temp; this function e nds. } else if ((nbrC <= nbrA) && (nbrC <= nbrB)) Thus, thefunction m changethe ight { value of thethre param te so the s e e rs, temp = nbrA; nbrA = nbrC; param te arepasse by re re . e rs d fe nce nbrC = temp; } if (nbrC < nbrB) { temp = nbrB; nbrB = nbrC; nbrC = temp; } return; } void outputThreeNumbers(int smallest, { cout << endl << endl; cout << "The smallest number is: " cout << "The middle number is: " cout << "The largest number is: " cout << endl << endl; return; } CS 140 int middle, int lar...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern