? asked in 電腦與網際網路程式設計 · 1 decade ago

寫函式void sort2( )..?

寫函式void sort2( )將傳入的兩個參數a和b比較後,讓a的值都比b大

誰會阿 邦個忙吧!!

1 Answer

Rating
  • 1 decade ago
    Favorite Answer

    void sort2(int &a,int &b)

    {

    int t;

    if (b > a)

    t = b;

    b = a;

    a = t;

    }

    你的問題表達不太清楚, 只能簡單寫這樣了

    如果不是傳整數參數,就自己把int的宣告換掉吧

Still have questions? Get your answers by asking now.