K12教育赛事综合服务平台
聚乐之家官方网站
下载聚乐之家官方App
专注青少年竞赛题库网站
#include <iostream> using namespace std; int main() { int arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}}; for(int i=0; i<3; i++) { for(int j=0; j<3; j++) { if(i == j) cout << arr[i][j] << " "; } } return 0; }
1 5 9
3 5 7
1 2 3
7 8 9