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

View Full Document Right Arrow Icon
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

This note was uploaded on 08/26/2009 for the course CS 140 taught by Professor Staff during the Fall '08 term at Southern Illinois University Edwardsville.

Ask a homework question - tutors are online