返回列表 發帖

陣列 (五) - 二維陣列

本帖最後由 李泳霖 於 2024-1-17 16:10 編輯

一個 3x4 的二維陣列,總共可以儲存 12 筆資料。

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n[3][4]={{1,2,3,4},
  7.                  {5,6,7,8},
  8.                  {9,10,11,12}};
  9.     for(int i=0; i<3; i++)
  10.     {
  11.        for(int j=0; j<4; j++)
  12.        {
  13.             cout<<"n["<<i<<"]["<<j<<"]="<<n[i][j]<<endl;
  14.        }
  15.     }
  16.     system("pause");
  17.     return 0;
  18. }
複製代碼

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見

TOP

此帖僅作者可見
甚麼是個人簽名

TOP

此帖僅作者可見

TOP

返回列表