找回密碼
 註冊
搜索
熱搜: 活動 交友 discuz
查看: 1863|回覆: 0

[原創] 簡易數據交換

[複製鏈接]
發表於 2007-6-1 11:45:57 | 顯示全部樓層 |閲讀模式
  1. #include<iostream>
  2. using namespace std;
  3. void Change(int *X, int *Y)
  4. {
  5.     int temp = *X ;
  6.     *X = *Y ;
  7.     *Y = temp ;
  8. }

  9. int main()
  10. {
  11.     int X=0,Y=0;
  12.    
  13.     cout << "X = " ;
  14.     cin >> X ;
  15.     cout << "Y = " ;
  16.     cin >> Y ;
  17.     cout << endl ;
  18.    
  19.     Change(&X,&Y);
  20.     cout << "X = " << X << endl << "Y = " << Y ;
  21.     cout << endl ;
  22.          
  23.     system("PAUSE");
  24.     return 0 ;
  25. }
複製代碼
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Checking the Pageranks

Archiver|手機版|小黑屋|WEO

GMT+8, 2026-7-29 08:16 PM , Processed in 0.024871 second(s), 18 queries .

Powered by Discuz! X5.0 Licensed

© 2001-2026 Discuz! Team.

快速回復 返回頂部 返回列表