📄 dim2_0.cpp
字号:
//dim2_0.cpp
#include <iostream.h> //cout
#include <conio.h> //getch()
#include <stdlib.h> //randomize(),random()
const int ROW=3;
const int COLUMN =4;
void main()
{ int a[ROW][COLUMN],i,j;
//randomize()
for (i=0;i<ROW;i++)
for (j=0;j<COLUMN;j++)
a[i][j]=random(100);
cout << "各元素的标注式输出:\n";
for (i=0;i<ROW;i++)
{ cout << " i j\n";
for (j=0;j<COLUMN;j++)
{ cout <<"a["<<i<<"]["<<j<<"]=";
cout.width(3);
cout<< a[i][j] << endl;
}
cout << endl;
}
cout << "行列式输出:\n";
cout << " 0 1 2 3\n";
for (i=0;i<ROW;i++)
{ cout << i << ' ';
for (j=0;j<COLUMN;j++)
{ cout.width(3);
cout<< a[i][j];
}
cout << endl;
}
cout << "按任意键继续....";getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -