< previous page page_a57 next page >

Page A57
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
{
    int temp;    // Temporary holding variable

    // Save value of first parameter

    temp = firstValue;

    // Shift values of next two parameters

    firstValue = secondValue;
    secondValue = thirdValue;

    // Replace value of final parameter with saved value

    thirdValue = temp;
}
b. Test program:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
#include <iostream.h>

void Rotate( int&, int&, int& );

int main()
{
    int int1;    // First input value
    int int2;    // Second input value
    int int3;    // Third input value

    cout << Enter three values: ;
    cin >> int >> int2 >> int3;

    cout << Before:  << int1 <<   << int2 <<  
         << int3 << endl;
    Rotate(int1, int2, int3);
    cout << After: << int1 <<   << int2 <<  
         << int3 << endl;
    return 0;
}

// The Rotate function, as above, goes here
Chapter 7
Case Study Follow-Up
2. void PrintData( /* in */ int   deptID,
                   /* in */ int   storeNum,
                   /* in */ float deptSales )
   {
      cout << setw(12) << Dept  << deptID << endl;

 
< previous page page_a57 next page >