<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 查找矩陣中每一行的最大元素 > 原文: [https://www.geeksforgeeks.org/find-maximum-element-row-matrix/](https://www.geeksforgeeks.org/find-maximum-element-row-matrix/) 給定一個矩陣,任務是找到每一行的最大元素。 **示例**: ``` Input : [1, 2, 3] [1, 4, 9] [76, 34, 21] Output : 3 9 76 Input : [1, 2, 3, 21] [12, 1, 65, 9] [1, 56, 34, 2] Output : 21 65 56 ``` **方法**:方法非常簡單。 這個想法是為 no_of_rows 運行循環。 檢查行內的每個元素,并找到最大元素。 最后,打印元素。 下面是實現: ## C++ ```cpp // C++ program to find maximum? // element of each row in a matrix #include<bits/stdc++.h> using namespace std; const int N = 4;? ????// Print array element ????void printArray(int result[], int no_of_rows) { ????????for (int i = 0; i < no_of_rows; i++) { ????????????cout<< result[i]<<"\n"; ????????} ????} ????// Function to get max element ????void maxelement(int no_of_rows, int arr[][N]) { ????????int i = 0; ????????// Initialize max to 0 at beginning ????????// of finding max element of each row ????????int max = 0; ????????int result[no_of_rows]; ????????while (i < no_of_rows) { ????????????for (int j = 0; j < N; j++) { ????????????????if (arr[i][j] > max) { ????????????????????max = arr[i][j]; ????????????????} ????????????} ????????????result[i] = max; ????????????max = 0; ????????????i++; ????????} ????????printArray(result,no_of_rows); ????} ????// Driver code ????int main() ????{ ????????int arr[][N] = { {3, 4, 1, 8}, ????????????????????????{1, 4, 9, 11}, ????????????????????????{76, 34, 21, 1}, ????????????????????????{2, 1, 4, 5} }; ????// Calling the function? ????????maxelement(4, arr); ????} // This code is contributed by Rajput-Ji ```
                  <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>

                              哎呀哎呀视频在线观看