home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / chplus / cecko / CPP / SWAP.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-05  |  484 b   |  18 lines

  1. // P⌐íklad: Programování v C++ na FJFI - ÇVUT
  2. #pragma hdrfile="TCDEF.SYM" // pro urychlení p⌐ekladu
  3. #include <iostream.h>
  4. #define swap(x,y) x=x+y;y=x-y;x=x-y;
  5.  
  6. int main(){
  7. /*  char t1='p';
  8.   char t2='d';
  9.   cout << "Vstup: " << t1 << " " << t2 << endl;
  10.   swap(t1,t2);
  11.   cout << "Vystup: " << t1 << " " << t2 << endl << endl;*/
  12.   int a=5;
  13.   int b=8;
  14.   cout << "Vstup: " << a << " " << b << endl;
  15.   swap(a,b);
  16.   cout << "Vystup: " << a << " " << b << endl;
  17.   return 0;
  18. }