double num[4][4]; for (int x=1;x<=4;x++) for (int y=1;y<=4;y++) { cout<<"请输入"< cin>>num[x][y]; } double he = 0.0; for (int xy=1;xy<=4;xy++) he = he+num[xy][xy]; cout<<"主对角线上元素之和为:"<