home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP30-3.ZIP / EXAMPLES.ZIP / INTRO35.CPP < prev    next >
C/C++ Source or Header  |  1992-02-18  |  401b  |  23 lines

  1. //INTRO35.CPP--Example from Chapter 3, "An Introduction to C++"
  2.  
  3. #include <iostream.h>
  4.  
  5. void swap(int *, int *);   // This is swap's prototype
  6.  
  7. int main()
  8. {
  9.     int x = 5, y = 7;
  10.     swap(&x, &y);
  11.     cout << "\n x is now "<< x << " and y is now " << y << '\n';
  12.  
  13.     return 0;
  14. }
  15.  
  16. void swap(int *a, int *b)    // swap is actually defined here
  17. {
  18.     int temp;
  19.     temp = *a;
  20.     *a = *b;
  21.     *b = temp;
  22. }
  23.