返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a,b,c;
  7.     cout<<"請依序輸入兩個正整數: ";
  8.     cin>>a>>b;
  9.     cout<<"對調前: ";
  10.     cout<<"x="<<a<<" y="<<b<<endl<<endl;
  11.    
  12.     c=a;
  13.     a=b;
  14.     b=c;
  15.    
  16.     cout<<"對調後: ";
  17.     cout<<"x="<<a<<" y="<<b<<endl<<endl;
  18.    
  19.     system("pause");
  20.     return 0;   
  21. }
複製代碼
李宇澤Oscar

TOP

返回列表