<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 程序用矩陣的下對角元素交換上對角元素。 > 原文: [https://www.geeksforgeeks.org/program-swap-upper-diagonal-elements-lower-diagonal-elements-matrix/](https://www.geeksforgeeks.org/program-swap-upper-diagonal-elements-lower-diagonal-elements-matrix/) 給定一個正方形矩陣,將矩陣的上對角線元素與矩陣的下對角線元素交換。 **示例**: ``` Input: 2 3 5 6 4 5 7 9 8 6 4 9 1 3 5 6 Output: 2 4 8 1 3 5 6 3 5 7 4 5 6 9 9 6 Input: 1 2 3 4 5 6 7 8 9 Output: 1 4 7 2 5 8 3 6 9 ``` 以下是上述想法的實現: ## C++ ```cpp // CPP Program to implement matrix // for swapping the upper diagonal // elements with lower diagonal? // elements of matrix. #include <bits/stdc++.h> #define n 4 using namespace std; // Function to swap the diagonal? // elements in a matrix. void swapUpperToLower(int arr[n][n]) { ????// Loop for swap the elements of matrix. ????for (int i = 0; i < n; i++) { ????????for (int j = i + 1; j < n; j++) { ????????????int temp = arr[i][j]; ????????????arr[i][j] = arr[j][i]; ????????????arr[j][i] = temp; ????????} ????} ????// Loop for print the matrix elements. ????for (int i = 0; i < n; i++) { ????????for (int j = 0; j < n; j++) ????????????cout << arr[i][j] << " "; ????????cout << endl; ????} } // Driver function to run the program int main() { ????int arr[n][n] = { { 2, 3, 5, 6 }, ????????????????????{ 4, 5, 7, 9 }, ????????????????????{ 8, 6, 4, 9 }, ????????????????????{ 1, 3, 5, 6 } }; ????// Function call ????swapUpperToLower(arr); ????return 0; } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看