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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                這次實例的要求是: 在n行n列的二維整數數組中,按照以下要求選出兩個數。首先從每行中選出最大數,在從選出的n個最大數中選出最小數;其次,從每行選出最小數,再從選出的n個小數中選出最大數。 下面就是我的代碼,在注釋中可以看到我的想法: ~~~ #include <stdio.h> /** * 實例要求: * 在n行n列的二維整數數組中, * 按照以下要求選出兩個數。 * 首先從每行中選出最大數,在從選出的n個最大數中選出最小數; * 其次,從每行選出最小數,再從選出的n個小數中選出最大數。 * */ int main(void) { int order; printf("%s\n","Please enter the order of the matrix:"); scanf("%d",&order); printf("Please input the elements of the matrix,from a[0][0] to a[%d][%d]:\n",order-1,order-1); int matrix[order][order]; /** * 獲取用戶輸入,并填充到二維數組中 */ int colums,rows; for(rows = 0;rows < order;rows++){ for(colums = 0; colums < order;colums++){ scanf("%d",&matrix[rows][colums]); //這里也可以這樣寫 //scanf("%d",matrix[rows]+colums); } } /** * 找到最大元素的最小元素 * */ //用于保存最大元素中的最小元素 int minInMax = 0; for(rows = 0;rows < order;rows++){ //用于保存行最大元素 int maxInLine = 0; for(colums = 0;colums < order;colums++){ if(matrix[rows][colums] > maxInLine) maxInLine = matrix[rows][colums]; } if(rows == 0){ //當獲取到第一行的最大元素時,直接賦值給最小元素 minInMax = maxInLine; }else{ if(minInMax > maxInLine) minInMax = maxInLine; } } printf("The minimum of maximum number is %d.\n",minInMax); /** * 找到最小元素的最大元素 * */ //用于保存最小元素中的最大元素 int maxInMin = 0; for(rows = 0;rows < order;rows++){ //用于保存行最小元素 int minInLine = matrix[rows][0]; for(colums = 0;colums < order;colums++){ if(matrix[rows][colums] < minInLine) minInLine = matrix[rows][colums]; } if(rows == 0){ //當獲取到第一行的最小元素時,直接賦值給最大元素 maxInMin = minInLine; }else{ if(maxInMin < minInLine) maxInMin = minInLine; } } printf("The maximum of minimum number is %d.\n",maxInMin); 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>

                              哎呀哎呀视频在线观看