返回列表 發帖
本帖最後由 李唯銘 於 2024-7-6 14:45 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int x,y,z;
  8.     cout<<"依序輸入兩個數"<<endl;
  9.     cin>>x>>y;
  10.     cout<<"對調前:x="<<x<<" y="<<y<<endl;
  11.     z=x;
  12.     x=y;
  13.     y=z;
  14.     cout<<"對調後:x="<<x<<" y="<<y<<endl;


  15.     system ("pause");
  16.     goto re;
  17.     return 0;
  18. }
複製代碼

TOP

返回列表