返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     int a,b,tmp;
  6.     cout<<"請依序輸入兩個正整數:"<<endl;
  7.     cin>>a>>b;
  8.     cout<<endl;
  9.     cout<<"對調前: "<<"x="<<a<<",y="<<b<<endl;

  10.     tmp=a;
  11.     a=b;
  12.     b=tmp;

  13.     cout<<"對調後: "<<"x="<<a<<",y="<<b<<endl;


  14. system("pause");
  15. return 0;
  16. }
複製代碼

TOP

返回列表